Yolov3+SORT_on_FLIR_Dataset

Authors:

Prashant Agrawal
Pulkit Jain

Description:

In this repository, a "YOLOv3: An Incremental Improvement" detector has been trained on the open sourced FLIR Dataset. Apart from training a detector, the task was also to track the detected objects which was carried out using the "Simple Online and Realtime Tracking" algorithm. The mAP obtained for the "YOLOv3" detector trained on the "FLIR Dataset" is tabulated as follows:

Model Class Number Class Name Average Precision
0 Person 0.49848
Yolov3 @ 416 1 Bicycle 0.31797
2 Car 0.70044
3 Dog 0.00446

The overall mAP obtained for 4 classes is: 0.38033
The overall mAP obtained for the 3 dominant classes is: 0.50563

Model Class Number Class Name Average Precision
0 Person 0.60665
Yolov3 @ 608 1 Bicycle 0.38672
2 Car 0.76392
3 Dog 0.00420

The overall mAP obtained for 4 classes is: 0.44037
The overall mAP obtained for the 3 dominant classes is: 0.58576

The reason for low AP for the "Dog" class is the low presence of this class in the dataset as it is evident from the desciption of the FLIR Dataset. Also, this repository uses "YOLOv3 @ 608" for detecting objects as well as tracking.

Dataset:

Link: https://www.flir.in/oem/adas/adas-dataset-form/
This dataset basically provides three types of thermal images:

  1. train: Contains 8862 thermal images
  2. val: Contains 1366 thermal images
  3. video: Contains 4224 thermal images

The images present in the "train" and "val" folder were used as the "train" and "validation" sets respectively for training the "YOLOv3" detector and the mAP reported above is on the "validation" set of the FLIR Dataset. For the purpose of tracking the detected objects, the "video" folder of the FLIR Dataset is used.

How to run the code:

In order to run the code:

  1. The detections need to be saved to a text file which can be done by running the "YOLOv3 detector".
    python detect.py --image_folder data/flir/ --images_path data/flir/images/ --model_def config/yolov3-custom_flir.cfg --weights_path checkpoints/model_param_flir_608.pth --class_path data/flir/classes.names --text_file_path data/flir/det_yolov3_608/det_yolov3_608.txt --conf_thresh 0.8 --nms_thresh 0.5
  2. Once the detections have been stored in a text file, the next step is to run the "SORT tracker" code with the stored detections and save those images in a folder.
    python tracker.py --display True --path_to_detections data/flir/det_yolov3_608/det_yolov3_608.txt --path_to_images data/flir/images/ --path_to_store_trackers output/trackers/yolov3_608.txt --path_to_store_images_with_detections output/detections/
  3. After the images with trackers are stored in a folder, the last step will be to make a video out of it. The code provided here makes the video at the desired FPS (10 FPS recommended).
    python make_video.py --output_image_path output/detections/ --output_video_name flir_output_video.avi --fps 10