Skip to content

2damin/yolov3-pytorch

Folders and files

NameName
Last commit message
Last commit date

Latest commit

9547ac5 · May 19, 2022
Apr 29, 2022
Dec 7, 2021
Apr 29, 2022
Apr 12, 2022
May 12, 2022
May 19, 2022
Apr 29, 2022
Mar 30, 2022
Apr 12, 2022
Apr 29, 2022
Mar 29, 2022
Mar 29, 2022
Apr 29, 2022
Mar 29, 2022
Mar 25, 2022
Apr 28, 2022
May 7, 2022
May 7, 2022
May 7, 2022
May 7, 2022

Repository files navigation

YOLOv3-pytorch

single stage object detection Yolov3.

This is made with Pytorch.


Install

Windows

Use Anaconda

  1. Download Anaconda : https://www.anaconda.com/products/individual#windows
  2. conda create --name ${environment_name} python=3.8
  3. activate ${environment_name}
  4. git clone https://github.com/2damin/yolov3-pytorch.git

Linux

Use docker

I recommend Nvidia NGC docker image. link

  1. docker pull nvcr.io/nvidia/pytorch:xx.xx-py3
  2. docker run --gpus all -it --rm -v local_dir:container_dir -p 8888:8888 nvcr.io/nvidia/pytorch:xx.xx-py3
    1. check "nvidia-smi"
    2. check "nvcc --version"
  3. git clone https://github.com/2damin/yolov3-pytorch.git

Dependency

pip install -r requirements.txt

python >= 3.6

Numpy

torch >= 1.9

torchvision >= 0.10

tensorboard

tensorboardX

torchsummary

pynvml

imgaug

onnx

onnxruntime

Run

If training,

(single gpu) python main.py --mode train --cfg ./yolov3.cfg --gpus 0 --checkpoint ${saved_checkpoint_path}

(multi gpu) python main.py --mode train --cfg ./yolov3.cfg --gpus 0 1 2 3 --checkpoint ${saved_checkpoint_path}

If evaluate,

python main.py --mode eval --cfg ./yolov3.cfg --gpus 0 --checkpoint ${saved_checkpoint_path}

If test,

python main.py --mode demo --cfg ./yolov3.cfg --gpus 0 --checkpoint ${saved_checkpoint_path}

If converting torch to onnx,

target tensorrt version > 7

python main.py --mode onnx --cfg ./cfg/yolov3.cfg --gpus 0 --checkpoint ${saved_checkpoint_path}

target tensorrt version is 5.x

  1. ONNX_EXPORT = True in 'model/yolov3.py'

    tensorrt(v5.x) is not support upsample scale factor, so you have to change upsample layer not using scale factor.

python main.py --mode onnx --cfg ./cfg/yolov3.cfg --gpus 0 --checkpoint ${saved_checkpoint_path}

option

--mode : train/eval/demo.

--cfg : the path of model.cfg.

--gpu : if you use GPU, set 1. If you use CPU, set 0.

--checkpoint (optional) : the path of saved model checkpoint. Use it when you want to load the previous train, or you want to test(evaluate) the model.

--pretrained (optional) : the path of darknet pretrained weights. Use it when you want to fine-tuning the model.

Visualize training graph

Using Tensorboard,

tensorboard --logdir=./output --port 8888

Reference

YOLOv3 paper

KITTI dataset

error

  • if libgl.so error when cv2
apt-get update
apt-get install libgl1-mesa-glx

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages