question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Error while training in ResNet50RetinaNet - COCO 2017.ipynb

See original GitHub issue

When 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:closed
  • Created 6 years ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
hgaisercommented, Oct 16, 2017

Ah yeah the data generator assumed the following structure:

/path/to/COCO/
/path/to/COCO/annotations/
/path/to/COCO/train2017/
/path/to/COCO/val2017/

Where the val2017 and train2017 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.

0reactions
hgaisercommented, Oct 17, 2017

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Error while training on coco dataset - NVIDIA Developer Forums
I'm getting the following error, while trying to train a retinanet resnet_18 model with tao toolkit, any idea what this error means or...
Read more >
delete retinaNet (91438d2d) · Commits · 2021-1-capstone ...
35, - The mean and std are used during training to normalize the regression values (networks love normalization).
Read more >
Merge pull request #1 from fizyr/master (c057441b) · Commits ...
The pretrained MS COCO model can be downloaded [here](https://github.com/fizyr/keras-retinanet/releases). Results using the `cocoapi` are shown below (note: ...
Read more >
coco_training.ipynb - Colaboratory - Google Colab
Download and preprocess COCO/2017 to the following format (required by od networks): dataset = { 'images' : A tensor of float32 and shape...
Read more >
keras_retinanet 目标检测——自定义图片数据集的模型训练步骤
下面就可以在jupyter notebook运行examples里的ResNet50RetinaNet.ipynb进行测试,当然也可以在jupyter notebook中将文件保存成.py格式的在pycharm里 ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found