Imageai: I am getting errors with ImageAI TypeError: object of type 'NoneType' has no len() PLEASE HELP MEEE :'(

Created on 29 Aug 2019  路  8Comments  路  Source: OlafenwaMoses/ImageAI

Generating anchor boxes for training images and annotation...
Average IOU for 9 anchors: 0.98
Anchor Boxes generated.
Detection configuration saved in Person008/json/detection_config.json
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: 100


TypeError Traceback (most recent call last)

in ()
5 trainer.setDataDirectory(data_directory="Person008")
6 trainer.setTrainConfig(object_names_array=["Person008"], batch_size=4, num_experiments=100, train_from_pretrained_model="pretrained-yolov3.h5")
----> 7 trainer.trainModel()

1 frames

/usr/local/lib/python3.6/dist-packages/imageai/Detection/Custom/generator.py in __init__(self, instances, anchors, labels, downsample, max_box_per_image, batch_size, min_net_size, max_net_size, shuffle, jitter, norm)
34 self.net_w = 416
35
---> 36 if shuffle: np.random.shuffle(self.instances)
37
38 def __len__(self):

mtrand.pyx in mtrand.RandomState.shuffle()

TypeError: object of type 'NoneType' has no len()

I am getting this error when I run

from imageai.Detection.Custom import DetectionModelTrainer

trainer = DetectionModelTrainer()
trainer.setModelTypeAsYOLOv3()
trainer.setDataDirectory(data_directory="Person008")
trainer.setTrainConfig(object_names_array=["Person008"], batch_size=4, num_experiments=100, train_from_pretrained_model="pretrained-yolov3.h5")
trainer.trainModel()
help me if you need more details i'll reply to you BUT PLEASE HELP ME

Most helpful comment

you might have added names to your object_names_array that you didn't annotate

All 8 comments

Check the annotation. There may be some annotated boxes without class name "Person008" which does not match the parameter _object_names_array_ in _setTrainConfig()_

First of all, make sure to be running the last version of ImageAI, otherwise upgrade it.

No training samples were read. Check if every thing is correctly set up (the path to the folders with images/annotations). Also consider double checking the annotation files.

Please, update your status on this, or close it otherwise.

I also checked my xml file. But it shows correctly. I am having latest version of imageai also. Please help me out to solve my problem.

you might have added names to your object_names_array that you didn't annotate

Yes You are right, It's Running bro, Thanks

I got this error how i can fix it. Please help me.

you might have added names to your object_names_array that you didn't annotate

My issue was solved with this, I placed the wrong object array name.
Also, The imageAI functions are quite outdated as I keep getting a depreciated warning while running my programs. Does anyone know when it'll be updated!

I am also getting this error, but in my case, everything works fine when I put all files in the train folder. the error comes as soon as I move some files to the validation folder. same files if put to the train folder works fine. I am using latest version of imageai. does anyone has faced this problem?

Was this page helpful?
0 / 5 - 0 ratings