Skip to content

Object Detection for Video with MXNet and GluonCV using YOLOv3

License

Notifications You must be signed in to change notification settings

HaydenFaulkner/VideoYOLO

Repository files navigation

VideoYOLO

A fast, accurate and diverse object detection pipeline for video written in MXNet and Gluon based on the YOLOv3 network

Datasets

The currently supported datasets are - Pascal VOC, MS-COCO, ImageNet-DET and ImageNet-VID. You can utilise the datasets separately or combine them together to make a single dataset. The table below presents some of the statistics for the datasets:

For more information see datasets

Models

For more information see models

Installation

Install youtube-dl using the following command (at time of writing pip install youtube-dl contains bug that prevents download of videos

sudo curl -L https://yt-dl.org/downloads/latest/youtube-dl -o /usr/local/bin/youtube-dl
sudo chmod a+rx /usr/local/bin/youtube-dl

Install via pip or conda

pip conda
pip install -r requirements.txt             
conda env create -f environment.yml           
conda activate viddet-mx

Usage

Training

To train a model you can use something like:

python train_yolov3.py --dataset voc --gpus 0,1,2,3 --save_prefix 0001 --warmup_epochs 3 --syncbn

If you don't have this much power available you will need to specify a lower batch size (this also will default to one GPU):

python train_yolov3.py --batch_size 4 --dataset voc --save_prefix 0001 --warmup_epochs 3

.......

Finetuning

To finetune a model you need to specify a --resume path to a pretrained params model file and specify the --trained_on dataset, the model will be finetuned on the dataset specified with --dataset

python train_yolov3.py --dataset voc --trained_on coco --resume models/experiments/0003/yolo3_darknet53_coco_best.params --gpus 0,1,2,3 --save_prefix 0006 --warmup_epochs 3 --syncbn

.......

Detection, Testing & Visualisation

To evaluate a model you can use something like:

python detect_yolov3.py --batch_size 1 --model_path models/experiments/0001/yolo3_darknet53_voc_best.params --metrics voc --dataset voc --save_prefix 0001

You can also evaluate on different data than the model was trained on (voc trained model on vid set):

python detect_yolov3.py --trained_on voc --batch_size 1 --model_path models/experiments/0001/yolo3_darknet53_voc_best.params --metrics voc,coco,vid --dataset vid --save_prefix 0001

Visualisation is off by default add --visualise to write out images with boxes displayed