无法使用TMemoryStream读取布尔值(Cannot read boolean value with TMemoryStream)
我想用一行简单的代码读取一个布尔值:ReadBuffer(Result,1)。
阅读后,结果是真实的。 然而
结果:=不是结果
将不会将值切换为假。
我在这里显然是一个基本的错误。完整代码:
TYPE TCMemStream= class(TMemoryStream) public function ReadBoolean: Boolean; end; function TCMemStream.ReadBoolean: Boolean; begin ReadBuffer(Result, 1); Result:= NOT Result; <-------- after executing this line, Result has the same value Result:= false; <----- this works end;
I am trying to read a boolean value using a simple line piece of code like this: ReadBuffer(Result, 1).
After reading, Result is true. However
Result:= not Result
will not 'switch' the value false.
I am doing obviously a basic mistake here.Full code:
TYPE TCMemStream= class(TMemoryStream) public function ReadBoolean: Boolean; end; function TCMemStream.ReadBoolean: Boolean; begin ReadBuffer(Result, 1); Result:= NOT Result; <-------- after executing this line, Result has the same value Result:= false; <----- this works end;
原文:https://stackoverflow.com/questions/28383736
更新时间:2023-01-04 07:01
最满意答案
问题在于gradle压缩资产文件导致模型解析失败。 我禁用了
.pb
文件的压缩:aaptOptions { noCompress 'pb' }
The issue was with gradle compressing asset files which caused model parsing to fail. I disabled the compression for
.pb
files:aaptOptions { noCompress 'pb' }
相关问答
更多-
我解决了这个问题!! 在使用sess.run (tf.global_variables_initializer ())初始化网络后saver.restore (sess, FLAGS.checkpoint)您需要调用saver.restore (sess, FLAGS.checkpoint) sess.run (tf.global_variables_initializer ()) 。 重要说明 :在向图表添加新图层之前,必须实例化saver = tf_saver.Saver () 。 这样,当执行save ...
-
使用您引用的预处理功能训练了Inception模型。 因此,您的图像必须通过该功能而不是VGG / ResNet的功能。 不需要减去均值。 另请参阅此主题: https : //github.com/fchollet/keras/issues/5416 。 原始GoogleNet论文指的是RGB图像而不是BGR。 另一方面,VGG使用Caffe进行训练,Caffe使用OpenCV加载默认使用BGR的图像。 是。 另请参阅此主题和Marcins的回答: 我应该在inception_v3.py keras中减去 ...
-
首先,一般警告。 TensorFlow for Poets codelab的编写方式不是非常适合生产服务(部分表现在你必须实现的变通方法)。 您通常会导出一个不包含所有额外培训操作的预测特定图表。 因此,虽然我们可以尝试将某些有效的东西组合在一起,但可能需要额外的工作才能生成此图。 代码的方法似乎是导入一个图,添加一些占位符,然后导出结果。 这通常很好。 但是,在问题中显示的代码中,您要添加输入占位符而不实际将它们连接到导入图形中的任何内容。 最终得到一个包含多个断开连接的子图的图形,例如(原理图): im ...
-
Android上的TensorFlow重新训练的初始v3模型崩溃(TensorFlow retrained inception v3 model crashes on Android)[2023-04-11]
问题在于gradle压缩资产文件导致模型解析失败。 我禁用了.pb文件的压缩: aaptOptions { noCompress 'pb' } The issue was with gradle compressing asset files which caused model parsing to fail. I disabled the compression for .pb files: aaptOptions { noCompress 'pb' } -
你可以下载一些其他图像,看看它们是否工作? 这个问题真的是你的图片加载我认为... 否则,请尝试使用pyplot读取图像: import matplotlib.pyplot as plt image = plt.imread('image.jpg') I've found a solution. Although I can't modify it to support the PNG format, but I can read the PNG image and convert it to JPEG ...
-
我解决了它。 该错误发生是因为该文件夹没有足够的图像进行训练 。 因此,在将图像数量从14增加到38后,它给出了预测! I solved it. The error occured because the folder hadn't got enough images to train with. So after increasing the number of the images from 14 to 38 it gives me the predictions!
-
我是否有可能只用cpu训练inception-v3模型?(Is it possible that I can train inception-v3 model only with cpu?)[2022-05-15]
我自己解决了这个愚蠢的问题。 我买了一台GTX 960,谢谢大家。 我一步一步地重新开始如下: http : //blog.twman.org/2016/06/tensorflow.html I have resolve this stupid question by myself. I have bought a GTX 960, thanks everyone. My reslove step by step as follow: http://blog.twman.org/2016/06/tensor ... -
Google的Slaven Bilac昨天发布的帖子似乎就是答案。 This posting yesterday by Google's Slaven Bilac appears to be the answer.
-
看起来retrain.py脚本和教程刚刚更新,可以与mobilenet架构配合使用。 所以这解决了问题的第一部分,它实际上并不是初始的5h,但它在移动设备上运行良好,准确性比inception5h好得多。 要实际让它在Android示例中运行,您仍需要更新这些设置 。 我认为您应该能够从重新训练脚本中复制为您选择的移动网络确定的设置 ,您可能没问题。 如果你想使用另一个不具备retrain.py设置的网络,那么我能想到的最简单的方法就是用TensorBoard探索图形。 因此,如果你真的想使用inh 5h, ...
-
正如评论中所讨论的,为每台机器上的第i个任务设置CUDA_VISIBLE_DEVICES=i可以解决问题。 这具有更改GPU命名的效果(因此每个工作者任务都有一个名为"/gpu:0" GPU设备,对应于该任务中的单个可见设备),但它可以防止同一台机器上的不同TensorFlow进程相互干扰。 以下命令应该可以工作: # On machine1: CUDA_VISIBLE_DEVICES='' python imagenet_distributed_train.py --ps_hosts=worker1:22 ...