hhk7734 / tensorflow-yolov4

YOLOv4 Implemented in Tensorflow 2.
MIT License
136 stars 75 forks source link

Can i disable some of classes on trained model? How can i do it? #78

Closed cheshire2445 closed 3 years ago

cheshire2445 commented 3 years ago

Let's say my model trained to detect 10 different classes. I am making an application where, depending on the enabled checkbox, certain objects in the images must be recognized. How can I disable some classes on recognition

cheshire2445 commented 3 years ago

I really need help. Thanks @hhk7734

hhk7734 commented 3 years ago

in Model? or after prediction?

cheshire2445 commented 3 years ago

в модели? или после предсказания?

The model has already been trained to recognize multiple classes. I need to somehow "disable" some classes before predicting, if possible. I thought it might be possible to modify the .weights file, but I cannot open it with any editor. help (YOLOv4) also gave nothing. Is it possible to run a model trained on 10, for example, so that it recognizes 1 of them and ignores another 9?

cheshire2445 commented 3 years ago

Now it has already been trained to detect 2 classes: yologun = YOLOv4() yologun.classes = {0: "gun", 1: "knife"} yologun.input_size = (416, 416)

I need something like this to detect only one class (but it doesn't work since the sizes of the models do not match): yologun = YOLOv4() yologun.classes = {0: "gun"} yologun.input_size = (416, 416)

hhk7734 commented 3 years ago

After the model is trained, there is no way to selectively predict. If you want to disable some classes, remove unnecessary classes from the result after inference.