single stage object detection Yolov3.
This is made with Pytorch.
- Download Anaconda : https://www.anaconda.com/products/individual#windows
- conda create --name ${environment_name} python=3.8
- activate ${environment_name}
- git clone https://github.com/2damin/yolov3-pytorch.git
I recommend Nvidia NGC docker image. link
- docker pull nvcr.io/nvidia/pytorch:xx.xx-py3
- docker run --gpus all -it --rm -v local_dir:container_dir -p 8888:8888 nvcr.io/nvidia/pytorch:xx.xx-py3
- check "nvidia-smi"
- check "nvcc --version"
- git clone https://github.com/2damin/yolov3-pytorch.git
pip install -r requirements.txt
python >= 3.6
Numpy
torch >= 1.9
torchvision >= 0.10
tensorboard
tensorboardX
torchsummary
pynvml
imgaug
onnx
onnxruntime
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
-
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}
--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.
Using Tensorboard,
tensorboard --logdir=./output --port 8888
- if libgl.so error when cv2
apt-get update
apt-get install libgl1-mesa-glx