Skip to content

Repository files navigation

Updated Version of YOLOv7 with CUDA Fix

Description

  • Integrated from yolov7 official repo https://github.com/WongKinYiu/yolov7, fixed the issue on cuda core can't run on yolov7 model. Tested on conda environment with python3.9, pytorch=1.11.0, cudatoolkit=1.13

Performance

MS COCO

Model Test Size APtest AP50test AP75test batch 1 fps batch 32 average time
YOLOv7 640 51.4% 69.7% 55.9% 161 fps 2.8 ms
YOLOv7-X 640 53.1% 71.2% 57.8% 114 fps 4.3 ms
YOLOv7-W6 1280 54.9% 72.6% 60.1% 84 fps 7.6 ms
YOLOv7-E6 1280 56.0% 73.5% 61.2% 56 fps 12.3 ms
YOLOv7-D6 1280 56.6% 74.0% 61.8% 44 fps 15.0 ms
YOLOv7-E6E 1280 56.8% 74.4% 62.1% 36 fps 18.7 ms

Installation on Windows

Conda environment -- Anaconda https://www.anaconda.com/
Python -- Python 3.9 installed with Anaconda

Install Anaconda

Select Installation Type : 'just me'
Anaconda Install Location : Anywhere you want, doesn't have to be on C drive
Advanved Installation Options :
image

Clone yolov7 Repo

Run git clone https://github.com/FlyerJB/YOLOv7-RoboMaster.git on your command prompt to some dir under C:/ drive or your OS drive to avoid Enviornment failure \

Make Conda Environment

Open Conda Command Prompt with Admin Right
Cd into yolov7 dir with cd <where you clone your yolov7>
And craete Conda Environment Conda Create -n <The Name You Like> Python3.9

image

Activate Conda Environment

Run command Conda activate <The Name You put from previous step>

pip install required packages

Option 1 : Install yolov7 for training on CPU
pip install -r requirements.txt

Option 2 : Install yolov7 for training on RTX GPU
pip install -r requirement_nv_gpu.txt

Validate Cuda Installation ( required for nv_gpu training )

Run python or python3 or py to run python
Run import torch
Run torch.cuda_is_available()
If it returns True, it means CUDA is successfully install on your device with Pytorch.

Training

With GPU training

# train p6 models
python train.py --workers 1 --device 0 --batch-size 8 --epochs 50 --img 640 640 --data data/coco_custom.yaml --hyp data/hyp.scratch.custom.yaml --cfg cfg/training/yolov7-custom.yaml --name yolov7-custom-tut5-v1 --weights yolov7.pt

With CPU training

# train p6 models
python train.py --workers 1 --device CPU --batch-size 8 --epochs 50 --img 640 640 --data data/coco_custom.yaml --hyp data/hyp.scratch.custom.yaml --cfg cfg/training/yolov7-custom.yaml --name yolov7-custom-tut5-v1 --weights yolov7.pt

About

Use for the object detection training. Applied with anaconda. Fixed the issue that GPU didn't recognized.

Topics

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages