datvuthanh / HybridNets

HybridNets: End-to-End Perception Network
MIT License
588 stars 120 forks source link

Multi-class vs multi-label segmentation #40

Open xoiga123 opened 2 years ago

xoiga123 commented 2 years ago

15 #38

We were using multi-label dataloader, loss and metrics for a multi-class problem. Basically they work fine and the results are correct (maybe focal loss segment is a little bit off, who knows, will check further) but to someone reading the code, the semantic meaning is wrong.

TODO: Generalize to multi-class as default, with a switch to multi-label. TODO in another issue: Multi-label for object detection.

xoiga123 commented 2 years ago

For multi-label object detection, we're waiting for a best practice from yolov5. Currently, their dataloader is like this:

The training labels go to something like that. cls_1, x1, y1, w1, h1 cls_2, x1, y1, w1, h1 cls_3, x2, y2, w2, h2 cls_4, x2, y2, w2, h2

After squeezing, the labels go to row_num1, x1, y1, w1, h1 row_num2, x2, y2, w2, h2 [row_num1] cls_1, cls_2 [row_num2] cls_3, cls_4

Personally, I do not like this approach. But again, the results say otherwise. So if it works, it works. Unless anyone's got a better implementation.