simplify load image
@@ -163,12 +163,9 @@ def list_dirs(path):
def load_img(file_path):
- # load the raw data from the file as a string
img = tf.io.read_file(file_path)
- # convert the compressed string to a 3D uint8 tensor
- img = tf.image.decode_jpeg(img, channels=3)
- # Use `convert_image_dtype` to convert to floats in the [0,1] range.
- img = tf.image.convert_image_dtype(img, tf.float32)
+ img = tf.image.decode_image(img, channels=3, dtype=tf.float32)
+
return img
