duanzhiihao / RAPiD

RAPiD: Rotation-Aware People Detection in Overhead Fisheye Images (CVPR 2020 Workshops)
http://vip.bu.edu/rapid/
Other
212 stars 63 forks source link

How to add classification detection #23

Open MHerique opened 3 years ago

MHerique commented 3 years ago

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,

duanzhiihao commented 3 years ago

Hi, thank you for your interest.

  1. To support multi-class detection, you have to modify many things. Let's say there are c classes. We will replace 18 by 18+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 separate conf 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.
  2. "...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.
MHerique commented 3 years ago

Thank you very much for your quick answers.

Lan2Kailee commented 2 years ago

请问您解决了多分类的问题了吗?