WongKinYiu / yolov7

Implementation of paper - YOLOv7: Trainable bag-of-freebies sets new state-of-the-art for real-time object detectors
GNU General Public License v3.0
13.36k stars 4.21k forks source link

How to train yolov7 using dot annotation instead of bounding box? #1066

Open Snimm opened 1 year ago

Snimm commented 1 year ago

Yolo requires class_id center_x center_y width height annotation format, a bounding box. However for many dataset bounding box is not available. Most crowed counting dataset such as ShanghaiTech only have dot annotation available. Then how do I train Yolo v7 using dot annotation? I can convert one point into four points by assuming a arbitrary radius but is there a better way?

holger-prause commented 1 year ago

Does dot annotation means you have polygons?

You can either convert them to rect bounding boxes by using basic math and just train a regular model OR As you already have polygons - train an instance segmentation model which could give you your detections as polygons too(but maybe it could be a bit slower to train / during inference time - i dont have much experience there)!

See here: https://github.com/WongKinYiu/yolov7/issues/752 and here https://dsbyprateekg.blogspot.com/2022/09/how-to-train-custom-dataset-with-yolov7.html

Snimm commented 1 year ago

@holger-prause dot annotation means I only have one point for labeling instead of 4 points for bounding box. A dot is placed where the object is, instead of a creating a bounding box around the object. Example: __results___35_1

holger-prause commented 1 year ago

Interesting - learned something new :-) Unfortunately i don't know how you can convert such a thing to a bounding box or polygon required by yolov7 ;-(

yulin010101 commented 1 year ago

It is not possible to directly train with such annotations. You need to refer to related weakly supervised methods.