OlafenwaMoses / ImageAI

A python library built to empower developers to build applications and systems with self-contained Computer Vision capabilities
https://www.genxr.co/#products
MIT License
8.48k stars 2.18k forks source link

Custom Detection Model Training: Validation values schow always 0.000000 #827

Closed S13Drifter closed 9 months ago

S13Drifter commented 9 months ago

Hello there, I'm training a Custom Detection Model with two types of objects in the images to test out ImageAI. This is the Code: from imageai.Detection.Custom import DetectionModelTrainer ` trainer = DetectionModelTrainer() trainer.setModelTypeAsYOLOv3() trainer.setDataDirectory(data_directory="/content/drive/My Drive/MelipoAI/Dataset/melipo_ai") trainer.setTrainConfig(object_names_array=["jatai"], batch_size=4, num_experiments=200,`train_from_pretrained_model="yolov3.pt") trainer.trainModel()

It starts training the model but validation values are always at 0.000000

Generating anchor boxes for training images... thr=0.25: 1.0000 best possible recall, 7.42 anchors past thr n=9, img_size=416, metric_all=0.467/0.833-mean/best, past_thr=0.527-mean: pretrained weight loading failed. Defaulting to using random weight.

Pretrained YOLOv3 model loaded to initialize weights

Epoch 1/200

Train: 25it [00:03, 7.41it/s] box loss-> 0.10574, object loss-> 0.57634, class loss-> 0.00000 Validation: 16it [01:14, 4.64s/it] recall: 0.000000 precision: 0.000000 mAP@0.5: 0.000000, mAP@0.5-0.95: 0.000000

Epoch 2/200

Train: 25it [00:03, 7.57it/s] box loss-> 0.10004, object loss-> 0.18873, class loss-> 0.00000 Validation: 16it [01:17, 4.82s/it] recall: 0.000000 precision: 0.000000 mAP@0.5: 0.000000, mAP@0.5-0.95: 0.000000`

...and so on. What could be the reason? How can I fix this? Thanks

S13Drifter commented 9 months ago

Seems like the issue was that I only included one type of object. With more than one object it shows the validation values