Skip to content

Commit ac40bc3

Browse files
authored
Merge pull request #218 from isl-org/dvdhfnr/load-image
simplify load image
2 parents be16fc9 + 8e04fef commit ac40bc3

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

policy/openbot/utils.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -163,12 +163,9 @@ def list_dirs(path):
163163

164164

165165
def load_img(file_path):
166-
# load the raw data from the file as a string
167166
img = tf.io.read_file(file_path)
168-
# convert the compressed string to a 3D uint8 tensor
169-
img = tf.image.decode_jpeg(img, channels=3)
170-
# Use `convert_image_dtype` to convert to floats in the [0,1] range.
171-
img = tf.image.convert_image_dtype(img, tf.float32)
167+
img = tf.image.decode_image(img, channels=3, dtype=tf.float32)
168+
172169
return img
173170

174171

0 commit comments

Comments
 (0)