Closed keertika-11 closed 1 year ago
Solved it with help of this question on stackoverflow ,
images_path = glob.glob('/path_to_images*')
def validate_image(file_name):
tf.py_function(tf.print, inp=[file_name], Tout=[])
image = tf.io.read_file(file_name)
image = tf.io.decode_jpeg(image, channels=3)
image = tf.image.resize(image, [224, 224])
return image
accepted_extensions = ('jpg', 'png', 'bmp', 'gif')
files = list(filter(lambda x: x.lower().endswith(accepted_extensions), images_path))
ds = tf.data.Dataset.from_tensor_slices(files).map(validate_image)
count = 0
for i in ds:
count = count + 1
if (count % 20)== 0:
print(count, " completed")
# print(i)
pass
What happened?
looks I have a problem in my dataset, the training stopped in between. I have checked my images with Pillow, Scikit-learn, opencv, Tf.io.decode_jpeg but no corrupted images are detected
Relevant code
Relevant log output
tensorflow_hub Version
0.12.0 (latest stable release)
TensorFlow Version
other (please specify)
Other libraries
tensorflow==2.10.0
Python Version
3.x
OS
Linux