Skip to content

Commit

Permalink
Merge pull request #218 from isl-org/dvdhfnr/load-image
Browse files Browse the repository at this point in the history
simplify load image
  • Loading branch information
thias15 authored Sep 10, 2021
2 parents be16fc9 + 8e04fef commit ac40bc3
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 ac40bc3

Please sign in to comment.