Object of type 'NoneType' has no len() what it may mean?

hello I have got this error

Some labels have no annotations! Please revise the list of labels in your configuration.
Training on:    None
Training with Batch Size:  4
Number of Experiments:  200
Traceback (most recent call last):File "<ipython-input-19-a51080441509>", line 1, in <module>
    trainer.trainModel()File "C:\Users\User\Anaconda3\lib\site-packages\imageai\Detection\Custom\__init__.py", line 242, in trainModel
    norm=normalizeFile "C:\Users\User\Anaconda3\lib\site-packages\imageai\Detection\Custom\generator.py", line 36, in __init__
    if shuffle: np.random.shuffle(self.instances)File "mtrand.pyx", line 4824, in mtrand.RandomState.shuffleTypeError: object of type 'NoneType' has no len()

Originally I have around 200 files png and jpg files and multiple categories in description xml files, but I made a sample of 50 files with only one object and it is still showing me this error. Is there any specific problem the causes this error?

In your annotation XMLs, there are some labels without their corresponding coordinate values. Kindly review your annotation files and ensure they are valid.

1 Like

Thanks for the answer, but I still dont get it. All my files has coordinates I just double check every each of them. I’ll give you 3 examples may be you’ll see a pattern: