Yolo v5 environment configuration (gpu version)

1. Create yolo v5 environment

yolov5 defect detection case
Summary
This article is mainly for the pure white who uses yolov5 for the first time and does not even configure the parameters, and records the process of my first use.

From downloading yolov5, installing dependencies, to training models and recognizing them.

2. Download yolov5 and install dependencies

git way:

git clone https://github.com/ultralytics/yolov5.git

Download the zip directly from github and unzip it:

https://github.com/ultralytics/yolov5

Use pycharm to directly open this folder as a project.

For the first use, we will use two files, and we will touch other files in the future:

train.py is our script for training
detect.py is the script for detection

The first step in setting up the environment is to install the graphics card driver, and then to install cuda toolkit and cudnn.
You can choose to run YoloV5 as a CPU or GPU environment. The default CPU environment does not need to be configured, and the GPU environment needs to install cuda corresponding to the graphics card version.
1. Create a new virtual environment in the anaconda environment
insert image description here
2. Activate the switching environment,
go to the pytorch official website to query the version that matches CUDA, and run the corresponding command (https: https://pytorch.org/get-started/previous-versions/)
insert image description here
insert image description here

insert image description here
Verify that gpu version 3 is installed
insert image description here
, download yolo v5

4、

pip install -r requirements.txt  -i https://pypi.tuna.tsinghua.edu.cn/simple

(Comment out torch, etc.)
insert image description here
Problem:
AttributeError: module 'distutils' has no attribute 'version'
Solution:
https://zhuanlan.zhihu.com/p/556704117
insert image description here

pip install setuptools==58.0.4 -i https://pypi.tuna.tsinghua.edu.cn/simple

insert image description here

RuntimeError: a view of a leaf Variable that requires grad is being used in an in-place operation.
insert image description here
https://blog.csdn.net/hjxu2016/article/details/121303818

insert image description here

insert image description here

3. Training results

As follows:
insert image description here
Interpretation of results:
training times, GPU consumption
bounding box loss, target detection loss, classification loss, total, targets, P, R, [email protected], [email protected]:.95, validation set val Box, validation set val obj, validation set val cls
[email protected]:.95. It is obtained by calculating a map every 0.05 from iou from 0.5 to 0.95, and finally averaging these maps.
insert image description here

Guess you like

Origin blog.csdn.net/weixin_48888528/article/details/128040955