This code simply feeds yolo trained model into cv2 deep neural network
net = cv2.dnn.readNetFromDarknet(configPath, weightsPath)
and track the detected objects using sort
- download yolov3.weights and put it in yolo-coco folder
- make sure you have these libs installed:
- numpy
- imutils
- opencv
There is actually three different script, each doing a distinguished task.
This script is used to process images that are not necessarily taken in a sequence (images taken in different times). It only detects objects but no tracking is done.
Simply, put your images in input/image/. Run
python3 image_process.py
It will output:
- processed images (images with boxes and text) in output.
- in det_results/, text file for each image containing detected classes in this format:
classID confidence left top right bottom
This script is used to process images taken in a sequence (like video frames). It detects objects and track them.
Put your images in input/image/. Run
python3 seq_image_process.py
It will output:
- processed frames (images with boxes and text) in output.
- one CSV file with a line format like follows:
frame_index DetectionIndex_ClassName right top left bottom
This script is used to process videos. It detects objects and track them.
Rename your video to input.mp4 and move it to input/video. Run
python3 vid_process.py
It will output:
- processed frames (images with boxes and text) in output.
- processed video in AVI format named output.avi.
- one CSV file with a line format like follows:
frame_index DetectionIndex_ClassName right top left bottom
@article{redmon2016yolo9000,
title={YOLO9000: Better, Faster, Stronger},
author={Redmon, Joseph and Farhadi, Ali},
journal={arXiv preprint arXiv:1612.08242},
year={2016}
}
@inproceedings{Bewley2016_sort,
author={Bewley, Alex and Ge, Zongyuan and Ott, Lionel and Ramos, Fabio and Upcroft, Ben},
booktitle={2016 IEEE International Conference on Image Processing (ICIP)},
title={Simple online and realtime tracking},
year={2016},
pages={3464-3468},
keywords={Benchmark testing;Complexity theory;Detectors;Kalman filters;Target tracking;Visualization;Computer Vision;Data Association;Detection;Multiple Object Tracking},
doi={10.1109/ICIP.2016.7533003}
}