def capture_image(self):
image = np.empty((self.width, self.height, 3), dtype=np.uint8)
self.camera.capture(image, 'rgb')
float_caster = tf.cast(image, tf.float32)
dims_expander = tf.expand_dims(float_caster, 0);
resized = tf.image.resize_bilinear(dims_expander, [self.height, self.width])
normalized = tf.divide(tf.subtract(resized, [self.input_mean]), [self.input_std])
sess = tf.Session()
result = sess.run(normalized)
return result
评论列表
文章目录