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.37k stars 4.22k forks source link

merge different class bounding box #1803

Open ParkTaeJun991029 opened 1 year ago

ParkTaeJun991029 commented 1 year ago

I have trained with my custom dataset to detect helmet,harness the result is like this image

When a person is detected, there will be separate bounding boxes for the harness and the helmet. However, instead of having separate bounding boxes for the harness and helmet, I want to create a single class for the entire person indicating that this person is wearing a harness but not wearing a helmet. How can I achieve this?

vtyw commented 1 year ago

@ParkTaeJun991029 The simplest way to do this models wise is to use 3 detectors: one for detecting people in the images, one for classifying whether a cropped detected person is wearing a harness, and one for classifying whether a cropped detected person is wearing a helmet.

But you could achieve this in software instead of models by training yolov7 to detect people as well, and then writing an algorithm to match helmets and harnesses to individuals.

Is your dataset publicly available by any chance? Seems like a high quality set that I'd love to try training on.

arrahim75 commented 6 months ago

@ParkTaeJun991029 Have you solve this issue? I've been through this kind of approach before. All you need is to modify the detect.py and the utils.plots.py.

On detect.py: You need to transform your detected labels to a single string

On utils.plots.py: You need to modify the "plot_one_box" method to receive the single string (labels) from the detect.py