Closed adithya1111 closed 4 years ago
Weirdly enough, I experienced this error too but the image was present. I was working on a colab runtime and I just assumed it was an issue with the runtime getting disconnected.
I am working on a s3 dataset and sometimes there are data availability issues. A simple retry option could be very useful in running the model without interruptions
This change to the function read_image_bgr (open(open(path,'rb') in utils/image.py did the trick ` def read_image_bgr(path): """ Read an image in BGR format.
Args
path: Path to the image.
"""
# We deliberately don't use cv2.imread here, since it gives no feedback on errors while reading the image.
image = np.ascontiguousarray(Image.open(open(path,'rb')).convert('RGB'))
return image[:, :, ::-1]
`
Hey guys
I am trying to train a retina net model. After running for 2 epochs it failed with this message Image not found. I am able to open the file path perfectly using PIL and it is a PIL readable image
Epoch 3/20 7725/10000 [======================>.......] - ETA: 1:36:54 - loss: 1.4854 - regression_loss: 1.1512 - classification_loss: 0.3342Traceback (most recent call last): File "/home/CONCURASP/kumara/.local/bin/retinanet-train", line 10, in <module> sys.exit(main()) File "/home/CONCURASP/kumara/.local/lib/python3.6/site-packages/keras_retinanet/bin/train.py", line 542, in main initial_epoch=args.initial_epoch File "/opt/anaconda3/lib/python3.6/site-packages/keras/legacy/interfaces.py", line 91, in wrapper return func(*args, **kwargs) File "/opt/anaconda3/lib/python3.6/site-packages/keras/engine/training.py", line 1732, in fit_generator initial_epoch=initial_epoch) File "/opt/anaconda3/lib/python3.6/site-packages/keras/engine/training_generator.py", line 185, in fit_generator generator_output = next(output_generator) File "/opt/anaconda3/lib/python3.6/site-packages/keras/utils/data_utils.py", line 625, in get six.reraise(*sys.exc_info()) File "/opt/anaconda3/lib/python3.6/site-packages/six.py", line 703, in reraise raise value File "/opt/anaconda3/lib/python3.6/site-packages/keras/utils/data_utils.py", line 610, in get inputs = future.get(timeout=30) File "/opt/anaconda3/lib/python3.6/multiprocessing/pool.py", line 644, in get raise self._value File "/opt/anaconda3/lib/python3.6/multiprocessing/pool.py", line 119, in worker result = (True, func(*args, **kwds)) File "/opt/anaconda3/lib/python3.6/site-packages/keras/utils/data_utils.py", line 406, in get_index return _SHARED_SEQUENCES[uid][i] File "/home/CONCURASP/kumara/.local/lib/python3.6/site-packages/keras_retinanet/preprocessing/generator.py", line 379, in __getitem__ inputs, targets = self.compute_input_output(group) File "/home/CONCURASP/kumara/.local/lib/python3.6/site-packages/keras_retinanet/preprocessing/generator.py", line 344, in compute_input_output image_group = self.load_image_group(group) File "/home/CONCURASP/kumara/.local/lib/python3.6/site-packages/keras_retinanet/preprocessing/generator.py", line 190, in load_image_group return [self.load_image(image_index) for image_index in group] File "/home/CONCURASP/kumara/.local/lib/python3.6/site-packages/keras_retinanet/preprocessing/generator.py", line 190, in <listcomp> return [self.load_image(image_index) for image_index in group] File "/home/CONCURASP/kumara/.local/lib/python3.6/site-packages/keras_retinanet/preprocessing/csv_generator.py", line 208, in load_image return read_image_bgr(self.image_path(image_index)) File "/home/CONCURASP/kumara/.local/lib/python3.6/site-packages/keras_retinanet/utils/image.py", line 32, in read_image_bgr image = np.ascontiguousarray(Image.open(path).convert('RGB')) File "/opt/anaconda3/lib/python3.6/site-packages/PIL/Image.py", line 2931, in open "cannot identify image file %r" % (filename if filename else fp) PIL.UnidentifiedImageError: cannot identify image file '/datascience/adi/image_segmentation_training/images/p0001017wkb9_1B3B41BDE7483FEDA03C1C5522BC658A.png'