Code Monkey home page Code Monkey logo

yolov3's Introduction

Language: 🇺🇸 🇨🇳

«YOLOv3» reproduced the paper "YOLOv3: An Incremental Improvement"

  • Train using the COCO train2017 dataset and test using the COCO val2017 dataset with an input size of 416x416. give the result as follows (No version of the COCO dataset used in the paper was found)
Original (darknet) DeNA/PyTorch_YOLOv3 zjykzj/YOLOv3(This)
ARCH YOLOv3 YOLOv3 YOLOv3
COCO AP[IoU=0.50:0.95] 0.310 0.311 0.314(v4.0)/0.315(v2.0)
COCO AP[IoU=0.50] 0.553 0.558 0.535(v4.0)/0.543(v2.0)

Table of Contents

Latest News

  • [2023/07/19]v4.0. Add ultralytics/yolov5(485da42) transforms and support AMP training.
  • [2023/06/22]v3.2. Remove Excess Code and Implementation.
  • [2023/06/22]v3.1. Reconstruct DATA Module and Preprocessing Module.
  • [2023/05/24]v3.0. Refer to zjykzj/YOLOv2 to reconstruct the entire project and train Pascal VOC and COCO datasets with YOLOv2Loss.
  • [2023/04/16]v2.0. Fixed preprocessing implementation, YOLOv3 network performance close to the original paper implementation.
  • [2023/02/16]v1.0. implementing preliminary YOLOv3 network training and inference implementation.

Background

The purpose of creating this warehouse is to better understand the YOLO series object detection network. Note: The realization of the project depends heavily on the implementation of DeNA/PyTorch_YOLOv3 and NVIDIA/apex

Prepare Data

Pascal VOC

Use this script voc2yolov5.py

python voc2yolov5.py -s /home/zj/data/voc -d /home/zj/data/voc/voc2yolov5-train -l trainval-2007 trainval-2012
python voc2yolov5.py -s /home/zj/data/voc -d /home/zj/data/voc/voc2yolov5-val -l test-2007

Then softlink the folder where the dataset is located to the specified location:

ln -s /path/to/voc /path/to/YOLOv3/../datasets/voc

COCO

Use this script get_coco.sh

Installation

Requirements

Refer to requirements.txt for installing the training environment

pip install -r requirements.txt

Container

Development environment (Use nvidia docker container)

docker run --gpus all -it --rm -v </path/to/YOLOv3>:/app/YOLOv3 -v </path/to/COCO>:/app/YOLOv3/COCO nvcr.io/nvidia/pytorch:22.08-py3

Usage

Train

  • One GPU
CUDA_VISIBLE_DEVICES=0 python main_amp.py -c configs/yolov3_coco.cfg --opt-level=O1 ../datasets/coco
  • Multi-GPUs
CUDA_VISIBLE_DEVICES=0,1,2,3 python -m torch.distributed.launch --nproc_per_node=4 --master_port "36321" main_amp.py -c configs/yolov3_coco.cfg --opt-level=O1 ../datasets/coco

Eval

python eval.py -c configs/yolov3_coco.cfg -ckpt outputs/yolov3_coco/model_best.pth.tar ../datasets/coco
 Average Precision  (AP) @[ IoU=0.50:0.95 | area=   all | maxDets=100 ] = 0.314
 Average Precision  (AP) @[ IoU=0.50      | area=   all | maxDets=100 ] = 0.535
 Average Precision  (AP) @[ IoU=0.75      | area=   all | maxDets=100 ] = 0.323
 Average Precision  (AP) @[ IoU=0.50:0.95 | area= small | maxDets=100 ] = 0.133
 Average Precision  (AP) @[ IoU=0.50:0.95 | area=medium | maxDets=100 ] = 0.342
 Average Precision  (AP) @[ IoU=0.50:0.95 | area= large | maxDets=100 ] = 0.467
 Average Recall     (AR) @[ IoU=0.50:0.95 | area=   all | maxDets=  1 ] = 0.272
 Average Recall     (AR) @[ IoU=0.50:0.95 | area=   all | maxDets= 10 ] = 0.413
 Average Recall     (AR) @[ IoU=0.50:0.95 | area=   all | maxDets=100 ] = 0.436
 Average Recall     (AR) @[ IoU=0.50:0.95 | area= small | maxDets=100 ] = 0.252
 Average Recall     (AR) @[ IoU=0.50:0.95 | area=medium | maxDets=100 ] = 0.473
 Average Recall     (AR) @[ IoU=0.50:0.95 | area= large | maxDets=100 ] = 0.594
python eval.py -c configs/yolov3_voc.cfg -ckpt outputs/yolov3_voc/model_best.pth.tar ../datasets/voc
VOC07 metric? Yes
AP for aeroplane = 0.8442
AP for bicycle = 0.8575
AP for bird = 0.7730
AP for boat = 0.6824
AP for bottle = 0.6737
AP for bus = 0.8505
AP for car = 0.8663
AP for cat = 0.8667
AP for chair = 0.6073
AP for cow = 0.8196
AP for diningtable = 0.7213
AP for dog = 0.8433
AP for horse = 0.8761
AP for motorbike = 0.8568
AP for person = 0.8245
AP for pottedplant = 0.5211
AP for sheep = 0.8140
AP for sofa = 0.7385
AP for train = 0.8304
AP for tvmonitor = 0.7727
Mean AP = 0.7820

Demo

python demo.py -c 0.6 configs/yolov3_coco.cfg outputs/yolov3_coco/model_best.pth.tar --exp coco assets/coco/

python demo.py -c 0.6 configs/yolov3_voc.cfg outputs/yolov3_voc/model_best.pth.tar --exp voc assets/voc2007-test/

Maintainers

  • zhujian - Initial work - zjykzj

Thanks

Contributing

Anyone's participation is welcome! Open an issue or submit PRs.

Small note:

License

Apache License 2.0 © 2022 zjykzj

yolov3's People

Contributors

zjykzj avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.