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.

Getting StopIteration: 'NoneType' object is not subscriptable

See original GitHub issue
count 	[44][5]
loss: 	[44][57.3060036]
loss: 	[44][173.999207]
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/dist-packages/keras/utils/data_utils.py", line 578, in get
    inputs = self.queue.get(block=True).get()
  File "/usr/lib/python3.6/multiprocessing/pool.py", line 644, in get
    raise self._value
  File "/usr/lib/python3.6/multiprocessing/pool.py", line 119, in worker
    result = (True, func(*args, **kwds))
  File "/usr/local/lib/python3.6/dist-packages/keras/utils/data_utils.py", line 401, in get_index
    return _SHARED_SEQUENCES[uid][i]
  File "/content/drive/keras-yolo3/generator.py", line 73, in __getitem__
    img, all_objs = self._aug_image(train_instance, net_h, net_w)
  File "/content/drive/keras-yolo3/generator.py", line 160, in _aug_image
    image = cv2.imread(image_name)[:,:,::-1] # RGB image
TypeError: 'NoneType' object is not subscriptable

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "train.py", line 251, in <module>
    _main_(args)
  File "train.py", line 210, in _main_
    max_queue_size   = 4
  File "/usr/local/lib/python3.6/dist-packages/keras/legacy/interfaces.py", line 91, in wrapper
    return func(*args, **kwargs)
  File "/usr/local/lib/python3.6/dist-packages/keras/engine/training.py", line 2192, in fit_generator
    generator_output = next(output_generator)
  File "/usr/local/lib/python3.6/dist-packages/keras/utils/data_utils.py", line 584, in get
    six.raise_from(StopIteration(e), e)
  File "<string>", line 3, in raise_from
StopIteration: 'NoneType' object is not subscriptable

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:15 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
ninjakxcommented, Apr 20, 2018

@Sun-Wu-kon yeah it’s filename gets changed. But even after having the images in png format it gave me an error . Are you able to train the model ?

1reaction
zx-code123commented, Apr 19, 2018

I met the same problem,did you solve it?@ninjakx

Read more comments on GitHub >

github_iconTop Results From Across the Web

TypeError: 'NoneType' object is not subscriptable in function
it is throwing type error because the value of 'value' is None. to avoid getting this error try- if value !=
Read more >
Python TypeError: 'NoneType' object is not subscriptable
The “TypeError: 'NoneType' object is not subscriptable” error is raised when you try to access items from a None value using indexing. This...
Read more >
StopIteration: 'PngImageFile' object is not subscriptable
StopIteration : 'PngImageFile' object is not subscriptable. python学习 keras ... line 578, in get inputs = self.queue.get(block=True).get() File ...
Read more >
[Solved] TypeError: 'NoneType' Object is Not Subscriptable
The error, NoneType object is not subscriptable, means that you were trying to subscript a NoneType object. This resulted in a type error....
Read more >
Python TypeError: cannot unpack non-iterable NoneType object
In Python, TypeError is subclass of Exception. Python sequence can be unpacked. This means you can assign content of sequence to multiple ...
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