NassimeBejaia commited on
Commit
9e67aa8
1 Parent(s): de15edd

Update Utils.py

Browse files
Files changed (1) hide show
  1. Utils.py +15 -7
Utils.py CHANGED
@@ -88,17 +88,25 @@ def decode_predictions(pred,greedy = True):
88
  # return img
89
 
90
 
 
 
 
 
 
 
 
 
 
 
 
 
91
  def encode_single_sample(path_dir):
92
  img = tf.io.read_file(path_dir)
93
- img = tf.io.decode_jpeg( img, name=None)
94
- img.set_shape([img.shape[0], img.shape[1],img.shape[-1]])
95
  img = tf.image.rot90(img, k=1, name=None)
96
- rand = tf.random.uniform( (), minval=0,maxval=1, dtype=tf.dtypes.float32,seed=None,name=None)
97
  img = tf.image.resize(img, [img_height, img_width])
98
-
99
- img=img/255.0
100
-
101
- return img
102
 
103
 
104
 
 
88
  # return img
89
 
90
 
91
+ # def encode_single_sample(path_dir):
92
+ # img = tf.io.read_file(path_dir)
93
+ # img = tf.io.decode_jpeg( img, name=None)
94
+ # img.set_shape([img.shape[0], img.shape[1],img.shape[-1]])
95
+ # img = tf.image.rot90(img, k=1, name=None)
96
+ # rand = tf.random.uniform( (), minval=0,maxval=1, dtype=tf.dtypes.float32,seed=None,name=None)
97
+ # img = tf.image.resize(img, [img_height, img_width])
98
+
99
+ # img=img/255.0
100
+
101
+ # return img
102
+
103
  def encode_single_sample(path_dir):
104
  img = tf.io.read_file(path_dir)
105
+ img = tf.io.decode_jpeg(img, channels=3) # Decode the image in RGB format
 
106
  img = tf.image.rot90(img, k=1, name=None)
 
107
  img = tf.image.resize(img, [img_height, img_width])
108
+ img = img / 255.0 # Normalize the pixel values
109
+ return img
 
 
110
 
111
 
112