Skip to content

This is a repository of YOLOv4-pytorch with PASCAL VOC and COCO

Notifications You must be signed in to change notification settings

yqqaqqy/YOLOv4-pytorch

 
 

Repository files navigation

YOLOv4-pytorch

This is a PyTorch re-implementation of YOLOv4 architecture based on the official darknet implementation AlexeyAB/darknet with PASCAL VOC, COCO and Custom dataset

results


Environment

  • Nvida GeForce RTX 2070
  • CUDA10.0
  • CUDNN7.0
  • windows or linux
  • python 3.6
# install packages
pip3 install -r requirements.txt --user

Brief

  • Mish
  • Custom data
  • Data Augment (RandomHorizontalFlip, RandomCrop, RandomAffine, Resize)
  • Multi-scale Training (320 to 640)
  • focal loss
  • GIOU
  • Label smooth
  • Mixup
  • cosine lr

Prepared work

1、Git clone YOLOv4 repository

git clone github.com/argusswift/YOLOv4-pytorch.git

update the "PROJECT_PATH" in the config/yolov4_config.py.


2、Download dataset

put them in the dir, and update the "DATA_PATH" in the params.py.

  • Convert data format :use utils/voc.py or utils/coco.py convert the pascal voc *.xml format (COCO *.json format)to *.txt format (Image_path0   xmin0,ymin0,xmax0,ymax0,class0   xmin1,ymin1...)

3、Download weight file

Make dir weight/ in the YOLOv4 and put the weight file in.


To train

Run the following command to start training and see the details in the config/yolov4_config.py

CUDA_VISIBLE_DEVICES=0 nohup python -u train.py  --weight_path weight/darknet53_448.weights --gpu_id 0 > nohup.log 2>&1 &

Also * It supports to resume training adding --resume, it will load last.pt automaticly by using commad

WEIGHT_PATH=weight/last.pt

CUDA_VISIBLE_DEVICES=0 nohup python -u train.py  --weight_path $WEIGHT_PATH --gpu_id 0 > nohup.log 2>&1 &

To test

modify your test img path:DATA_TEST=./data/test # your own images

CUDA_VISIBLE_DEVICES=0 python3 test.py --weight_path weight/best.pt --gpu_id 0 --visiual $DATA_TEST --eval

The images can be seen in the data/

Reference

About

This is a repository of YOLOv4-pytorch with PASCAL VOC and COCO

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%