RAPiD
RAPiD copied to clipboard
How to add classification detection
Hi!
I am trying to add classification detection in your code. I would know if you have a better trick to advise to me than what I am doing?
I am trying to change the YOLOBranche detection output from 18 to 21 (for two classes) or 24 (for three classes) to get one classification score by object. I would give bbox class during post-processing keeping the one class score with the higher value and with value > conf_threshold.
Does-it seems to you to be a good way to do?
I have a second question, Does-it seems to you possible, if the input image is square and at the same input size than the CNN input size, to jump over the resize() and the pad() function in the the rect_to_square() function during per-processing ?
thank you,
Hi, thank you for your interest.
- To support multi-class detection, you have to modify many things. Let's say there are
c
classes. We will replace18
by18+3*c
at https://github.com/duanzhiihao/RAPiD/blob/e56ac87b0422d98f2942dbfbc64b745a3a3149ae/models/rapid.py#L54 such that the output is [cx, cy, w, h, angle, conf score, class_1 score, class_2 score, ...], for three anchors. You could remove the conf score, but in the object detection community people often use a separateconf score
in addition to class scores. You also need to modify https://github.com/duanzhiihao/RAPiD/blob/e56ac87b0422d98f2942dbfbc64b745a3a3149ae/models/rapid.py#L98 to add the loss function for classification. For simplicity, you could simply use the Pytorch cross-entropy loss. - "...to jump over the resize() and the pad() function in the the rect_to_square() function during per-processing..." Yes! I didn't do it for code compactness. I encourage you to add some if-else statements to improve the pre-processing efficiency.
Thank you very much for your quick answers.
请问您解决了多分类的问题了吗?