Skip to content

ZeroAct/tracking-with-yolov5

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Tracking with yolov5

This implementation is for who need to tracking multi-object only with detector. You can easily track mult-object with your well trained yolov5 model. I used SORT algorithm implementation to track each bounding boxes.

And I added my nobel(maybe) smoothing method. This method reduces the shaking of bounding boxes. You can easily deactivate smoothing method by specifying --no_smoothing option.

I hope this repository can help someone :)

Update

I added class_idto results file and video.
Same number with same class_id.
Same color box with same object_id.

Preparation

This implementation use yolov5 detection results. If you have another trained detector just follow this format.

# file name
[video_name]_[frame_idx].txt

# center_x, center_y, width, height should be normalized with Video Width Height
class_id center_x center_y width height confidence 
...

or just run (if you have trained yolov5 model)

python detect.py  --weights [your model weight]
                  --source  [video path]
                  --save-txt --save-conf --nosave --iou-thres 1 --img 640  # keep this line same

Run

I uploaded a sample dataset in sample_data directory. If you want to use this data, just run

python main.py --show

If you have your own dataset, run

python main.py  --video_path [video path]
                --det_dir    [labels directory (output of yolov5 detect)]
                --show       [if you want to pre-visualize the results]

Result

You can find your result video and text file under results directory.

# text file format
frame_idx x1 y1 x2 y2 object_id class_id