qqwweee / keras-yolo3

A Keras implementation of YOLOv3 (Tensorflow backend)
MIT License
7.14k stars 3.45k forks source link

After training the model predicts classes which are not in the class file? #365

Open Cimino023 opened 5 years ago

Cimino023 commented 5 years ago

Hi! I'm trying to train a model to recognize 4 classes. These classes are different from any popular class list (4 different microalgae types). I have taken and labelled the pictures correctly in the train.txt file, I have created my own classes.txt file and then run : python convert.py -w yolov3.cfg yolov3.weights model_data/yolo_algae.h5 then I modified the train.py file with the correct annotation_path, classes_path and weights_path, anchors, batches and everything else are left as default. Then train.py runs quite smoothly but when the training is ended and I run: python yolo_video.py --model model_data/yolo_algae.h5 --classes model_data/algae_classes.txt --image the model recognized a "bird".

I do not even have "bird" in the provided class file so I guess I must have misunderstood how the whole training process for custom classes has to be done.

Nothing to say about performances as I have labelled a ridiculously little dataset (60 images) just to check if I was able to train my so customized model

bluesy7585 commented 5 years ago

its a bug i think, command line arguments cant not override. its doesn't use your classes.txt. https://github.com/qqwweee/keras-yolo3/pull/247

OtiTantaoui commented 5 years ago

try to directly change the path to the path of your classes in the folder. I m not sure why but when u call --image it cancels all the previous arguments and that 's why even if you specified you class path in the command it is not directed into that classes.txt. You can change the path directly in the yolo.py code