/yolov3_pytorch

bird detection by yolov3

Primary LanguagePython

License: MIT

Pytorch Implementation of Yolov3 For Bird Detection


This project provides a dataset for wild birds and yolov3 implementation in pytorch for training the dataset. This bird detection dataset is special in the sense that it also provides the dense labels of birds in flock. The images of birds are collected from the internet, partly by crawling. Label samples can be seen as followings.

Label Samples

TODO


  • Train on Bird Dataset
  • Export onnx weight and test inferencing on onnx weight
  • Train on multiple scales
  • Mish activation
  • Onnx Model

Preparation


python3 -m pip install -r requirements.txt
  • Download darknet53 backbone trained on imagenet dataset
python3 scripts/download_darknet_weight.py

After running this script, darknet53.conv.74 weights will be saved inside save_models directory.

  • Download bird dataset
python3 scripts/download_bird_dataset.py

The bird dataset will be saved and extracted in data directory

Scripts


  • Training (details for parameters please see train.py script)
python3 train.py --dataset bird_dataset --backbone_weight_path ./saved_models/darknet53.conv.74

Weights will be saved inside save_models directory.

  • Testing
python3 test.py --dataset bird_dataset --snapshot [path/to/snapshot] --image_path [path/to/image] --conf_thresh [confidence/thresh] --nms_thresh [nms/thresh]

A sample trained weight can be download from HERE

Test Result
  • Export to onnx model
python3 export_onnx.py --dataset bird_dataset --snapshot [path/to/weight/snapshot] --batch_size [batch/size] --onnx_weight_file [output/onnx/file]
  • Inferece with onnx
python3 inference_onnx.py --dataset bird_dataset --img_h [img/input/height] --img_w [img/input/width] --image_path [image/path] --onnx_weight_file [onnx/weight] --conf_thresh [confidence/threshold] --nms_thresh [nms_threshold]

References