def read_image(self, image_path):
# tf.decode_image does not return the image size, this is an ugly workaround to handle both jpeg and png
path_length = string_length_tf(image_path)[0]
file_extension = tf.substr(image_path, path_length - 3, 3)
file_cond = tf.equal(file_extension, 'jpg')
image = tf.cond(file_cond, lambda: tf.image.decode_jpeg(tf.read_file(image_path)),
lambda: tf.image.decode_png(tf.read_file(image_path)))
image = tf.image.convert_image_dtype(image, tf.float32)
image = tf.image.resize_images(image, [self.params.height, self.params.width], tf.image.ResizeMethod.AREA)
return image
monodepth_dataloader.py 文件源码
python
阅读 28
收藏 0
点赞 0
评论 0
评论列表
文章目录