【发布时间】:2019-04-24 15:03:14
【问题描述】:
我已经使用 tesnorflow 构建了一个分类器。我从图像生成提案区域,这些提案由我的分类器单独分类。
我的问题是在评估我的模型时我没有恒定的批量大小。因为每张图片都有不同数量的proposal,所以每张图片要评估的proposal数量不是恒定的。
现在我已将批量大小设置为 1,但这效率低下并且限制了我的分类器的处理速度。
下面是模型输入的占位符
self.image_op = tf.placeholder(tf.float32, shape=[batch_size, 48, 48, 3], name='input_image')
这就是我将输入提供给模型的方式
def predict(self,image):
cls_prob = self.sess.run([self.cls_prob], feed_dict={self.image_op: image})
return cls_prob
有没有什么方法可以将批量大小设置为动态值,而不必为每个图像恢复模型?
【问题讨论】:
-
尝试使用 self.image_op = tf.placeholder(tf.float32, shape=[None, 48, 48, 3], name='input_image')。它应该采用可变的批量大小
-
这行得通。谢谢!
标签: python tensorflow deep-learning classification