ImageAI - "TypeError: 'NoneType' object is not subscriptable"

719 Views Asked by At

When using the DetectModelTrainer() class in ImageAI on the first epoch at 839/840 I’m getting this error:

libpng warning: iCCP: known incorrect sRGB profile
Cannot find  crab\validation\images\533.257297283.jpg
Traceback (most recent call last):
  File "train.py", line 7, in <module>
    trainer.trainModel()
  File "C:\Users\cl\AppData\Local\Programs\Python\Python36\lib\site-packages\imageai\Detection\Custom\__init__.py", line 291, in trainModel
    max_queue_size=8
  File "C:\Users\cl\AppData\Local\Programs\Python\Python36\lib\site-packages\keras\legacy\interfaces.py", line 91, in wrapper
    return func(*args, **kwargs)
  File "C:\Users\cl\AppData\Local\Programs\Python\Python36\lib\site-packages\keras\engine\training.py", line 1732, in fit_generator
    initial_epoch=initial_epoch)
  File "C:\Users\cl\AppData\Local\Programs\Python\Python36\lib\site-packages\keras\engine\training_generator.py", line 242, in fit_generator
    workers=0)
  File "C:\Users\cl\AppData\Local\Programs\Python\Python36\lib\site-packages\keras\legacy\interfaces.py", line 91, in wrapper
    return func(*args, **kwargs)
  File "C:\Users\cl\AppData\Local\Programs\Python\Python36\lib\site-packages\keras\engine\training.py", line 1791, in evaluate_generator
    verbose=verbose)
  File "C:\Users\cl\AppData\Local\Programs\Python\Python36\lib\site-packages\keras\engine\training_generator.py", line 365, in evaluate_generator
    generator_output = next(output_generator)
  File "C:\Users\cl\AppData\Local\Programs\Python\Python36\lib\site-packages\keras\utils\data_utils.py", line 625, in get
    six.reraise(*sys.exc_info())
  File "C:\Users\cl\AppData\Local\Programs\Python\Python36\lib\site-packages\six.py", line 696, in reraise
    raise value
  File "C:\Users\cl\AppData\Local\Programs\Python\Python36\lib\site-packages\keras\utils\data_utils.py", line 610, in get
    inputs = future.get(timeout=30)
  File "C:\Users\cl\AppData\Local\Programs\Python\Python36\lib\multiprocessing\pool.py", line 644, in get
    raise self._value
  File "C:\Users\cl\AppData\Local\Programs\Python\Python36\lib\multiprocessing\pool.py", line 119, in worker
    result = (True, func(*args, **kwds))
  File "C:\Users\cl\AppData\Local\Programs\Python\Python36\lib\site-packages\keras\utils\data_utils.py", line 406, in get_index
    return _SHARED_SEQUENCES[uid][i]
  File "C:\Users\cl\AppData\Local\Programs\Python\Python36\lib\site-packages\imageai\Detection\Custom\generator.py", line 73, in __getitem__
    img, all_objs = self._aug_image(train_instance, net_h, net_w)
  File "C:\Users\cl\AppData\Local\Programs\Python\Python36\lib\site-packages\imageai\Detection\Custom\generator.py", line 163, in _aug_image
    image = image[:,:,::-1] # RGB image
TypeError: 'NoneType' object is not subscriptable

Is this just because it cannot find that image? Or is it something else? I’m just wondering because it’s such a long time until I can test the error with the image found.

Also is there any way to carry on from the same position after an error?

Thanks

0

There are 0 best solutions below