Community
cancel
Showing results for 
Search instead for 
Did you mean: 
jsmit119
Beginner
88 Views

yolov3-tiny model performs strangely

hi

I train a yolov3-tiny model with my own dataset.  The actual number of objects is 4, so I set [classes = 4, filters=27] in [yolov3-tiny.cfg].

After the training is completed, the model [yolov3-tiny.weights] is obtained. When [Darknet (.weights) -> Tensorflow (.pb)], the actual four categories in yolov3-tiny.names are set. In [Tensorflow(.pb)->OpenVINO(.bin)_convertion], in [yolo_v3_tiny_changed.json], set ["classes": 4]. This converts the IR model and detects nothing.

But when I change [4] to [80] (in [yolov3-tiny.cfg], set [classes = 80, filters=255], in [yolov3-tiny.names], set 80 categories, In [yolo_v3_tiny_changed.json], set ["classes": 80]). The IR model thus converted has a good detection effect.

Can someone tell me why this is happening?

 I am running on NCS2 FP16, SDK R5, Ubuntu18.04 . 

0 Kudos
3 Replies
Shubha_R_Intel
Employee
88 Views

Dear Joe, 

You ask an interesting question. I encourage you to upgrade to 2019 R1 by the way, though this has nothing to do with the question you ask. Increasing the number of classes from 4 to 80 would mean that those original 4 classes were not detected by Yolo, while when you increased the number of classes to 80 you increased the number of classes that could be detected - which improved detection. 

This yolov3 blog article explains it very well. Before yolo3, the previous yolo used softmax for classification - which means "..Softmaxing classes rests on the assumption that classes are mutually exclusive, or in simple words, if an object belongs to one class, then it cannot belong to the other. ".

Yolov3 uses logistic regression for class score prediction, where now instead of softmax, a threshold is used to predict multiple labels for an object. "Classes with scores higher than this threshold are assigned to the box.".

So Joe, your observation that increasing the number of classes would also increase detection results makes perfect sense, given the way Yolo3 is designed. Now keep in mind, tiny-yolo3 has the same essential design as the regular yolo3 - it just has considerably fewer layers (26 versus 106)  and is more "lightweight".

Hope it helps and thanks for using OpenVino !

Shubha

jsmit119
Beginner
88 Views

Shubha R. (Intel) wrote:

Dear Joe, 

You ask an interesting question. I encourage you to upgrade to 2019 R1 by the way, though this has nothing to do with the question you ask. Increasing the number of classes from 4 to 80 would mean that those original 4 classes were not detected by Yolo, while when you increased the number of classes to 80 you increased the number of classes that could be detected - which improved detection. 

This yolov3 blog article explains it very well. Before yolo3, the previous yolo used softmax for classification - which means "..Softmaxing classes rests on the assumption that classes are mutually exclusive, or in simple words, if an object belongs to one class, then it cannot belong to the other. ".

Yolov3 uses logistic regression for class score prediction, where now instead of softmax, a threshold is used to predict multiple labels for an object. "Classes with scores higher than this threshold are assigned to the box.".

So Joe, your observation that increasing the number of classes would also increase detection results makes perfect sense, given the way Yolo3 is designed. Now keep in mind, tiny-yolo3 has the same essential design as the regular yolo3 - it just has considerably fewer layers (26 versus 106)  and is more "lightweight".

Hope it helps and thanks for using OpenVino !

Shubha

hi Shubha

I upgraded [openvino] to 2019 and the problem was solved.

thank you

 

Shubha_R_Intel
Employee
88 Views

Dear smith, joe,

Fantastic. Glad to hear that 2019 R1 solved this issue.

Shubha

Reply