Skip to content

Commit

Permalink
simplify load image
Browse files Browse the repository at this point in the history
  • Loading branch information
David Hafner committed Sep 7, 2021
1 parent be16fc9 commit 8e04fef
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions policy/openbot/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down

0 comments on commit 8e04fef

Please sign in to comment.