I trained one custom object detection model for my use case using darknet and yolov4. I mentioned 3 classes in the obj.name file as mentioned below:
# data/obj.names
no_helmet
helmet
vest
The training was completed and detection was also working with good results.
Now, I wanted to add 2 new classes to the model, so I updated the class file with 2 new class names:
# data/obj.names
no_helmet
helmet
vest
fire
smoke
I made changes to the config file and updated classes=3 to classes=5 and filter=24 to filter=30 for all the [yolo] layers and preceding [convolutional] layers.
For the dataset, I only provided images and annotations for the 2 new classes (fire and smoke).
Then I started the darknet training and for the weights parameter, I provided my old yolov4 trained weights. After it was completed, I ran tests and it didn't detect anything in the image. Not even the old classes.
Where did I go wrong?
What I feel is that since I didn't provide a dataset for older classes, the model forgot those. But, then it should have at least detected new classes, right? or am I wrong here?
NEW EDIT:
I trained again with the combined dataset(old 3 classes and 2 new classes) on the pre-trained custom weights (trained for the first 3 classes) and when I ran it for the test, still no output is there.
Could somebody explain to me what's going on here? I'm thinking there is some mathematics behind it which I don't know about.
Do I have to train from scratch every time?