Error while training in ResNet50RetinaNet - COCO 2017.ipynb
See original GitHub issueWhen trying to run this notebook, I get the following error while evaluating the cell that does the training:
Epoch 1/50 Exception in thread Thread-6: Traceback (most recent call last): File “/Users/sayandevmukherjee/anaconda/envs/py36-tensorflow/lib/python3.6/threading.py”, line 916, in _bootstrap_inner self.run() File “/Users/sayandevmukherjee/anaconda/envs/py36-tensorflow/lib/python3.6/threading.py”, line 864, in run self._target(*self._args, **self._kwargs) File “/Users/sayandevmukherjee/anaconda/envs/py36-tensorflow/lib/python3.6/site-packages/keras/utils/data_utils.py”, line 568, in data_generator_task generator_output = next(self._generator) File “/Users/sayandevmukherjee/anaconda/envs/py36-tensorflow/lib/python3.6/site-packages/keras/preprocessing/image.py”, line 737, in next return self.next(*args, **kwargs) File “/Users/sayandevmukherjee/anaconda/envs/py36-tensorflow/lib/python3.6/site-packages/keras_retinanet-0.0.1-py3.6.egg/keras_retinanet/preprocessing/coco.py”, line 131, in next image_data = self.load_image(selection[0]) File “/Users/sayandevmukherjee/anaconda/envs/py36-tensorflow/lib/python3.6/site-packages/keras_retinanet-0.0.1-py3.6.egg/keras_retinanet/preprocessing/coco.py”, line 67, in load_image image, image_scale = resize_image(image, min_side=self.image_min_side, max_side=self.image_max_side) File “/Users/sayandevmukherjee/anaconda/envs/py36-tensorflow/lib/python3.6/site-packages/keras_retinanet-0.0.1-py3.6.egg/keras_retinanet/preprocessing/image.py”, line 47, in resize_image (rows, cols, _) = img.shape AttributeError: ‘NoneType’ object has no attribute ‘shape’
StopIteration Traceback (most recent call last) <ipython-input-6-871147d8694a> in <module>() 9 callbacks=[ 10 keras.callbacks.ModelCheckpoint(‘resnet50_coco_best.h5’, monitor=‘val_loss’, verbose=1, save_best_only=True), —> 11 keras.callbacks.ReduceLROnPlateau(monitor=‘val_loss’, factor=0.1, patience=2, verbose=1, mode=‘auto’, epsilon=0.0001, cooldown=0, min_lr=0), 12 ], 13 )
~/anaconda/envs/py36-tensorflow/lib/python3.6/site-packages/keras/legacy/interfaces.py in wrapper(*args, **kwargs)
85 warnings.warn('Update your ' + object_name + 86 '
call to the Keras 2 API: ’ + signature, stacklevel=2)
—> 87 return func(*args, **kwargs)
88 wrapper._original_function = func
89 return wrapper
~/anaconda/envs/py36-tensorflow/lib/python3.6/site-packages/keras/engine/training.py in fit_generator(self, generator, steps_per_epoch, epochs, verbose, callbacks, validation_data, validation_steps, class_weight, max_queue_size, workers, use_multiprocessing, shuffle, initial_epoch) 2009 batch_index = 0 2010 while steps_done < steps_per_epoch: -> 2011 generator_output = next(output_generator) 2012 2013 if not hasattr(generator_output, ‘len’):
StopIteration:
Am I missing something obvious? I did download the COCO train2017 and val2017 images and annotations.
Thanks for any help!
Issue Analytics
- State:
- Created 6 years ago
- Comments:6 (4 by maintainers)
Top GitHub Comments
Ah yeah the data generator assumed the following structure:
Where the
val2017
andtrain2017
folders hold the images. I assumed this was the structure which is to be expected from COCO as this is what you get if you extract all COCO archives in one folder. Do you think your structure is better?In any case, if you use the structure mentioned above it should find the data.
I see, I wasn’t aware of those instructions! I’ll change the generator such that it assumes the structure as suggested by cocoapi, that makes more sense. Thank you for bringing it to my attention 😃
I’ll go ahead and close this issue then.