当前位置:网站首页>Yolov5 advanced 5 GPU environment setup
Yolov5 advanced 5 GPU environment setup
2022-06-26 09:00:00 【Parity nonconservative 4.0】
I'm familiar yolov5 Of CPU Environmental Science , The next step is to build GPU The environment . from yolov2 tensorflow keras darknet, The original GPU Building is very cumbersome , It's not just about cuda and cudnn Corresponding , It should be completely consistent with the driver version , More in windows Environment sets a large number of environment variables and paths , This is a very imperfect solution . Now? yolov5 pytorch This problem no longer exists , It can be said that it can be completed with one click in the activation environment GPU Construction of environment .
First of all, check Your own graphics card supports cuda edition , Because the test I do with my notebook now , The graphics card tested is MX230, Don't laugh , The training speed has been significantly improved .
Right click on the desktop nvidia panel see cuda
Now my reality is 11.7, In fact, before I upgraded the driver, I was 10.0. If you want to support the new Cuda edition , Please go nvidia Download the new driver on the official website , Don't worry that this driver is backward compatible , You just need to install Support below cuda11.7 Of pytorch, In fact, when I posted this article ,pytorch Only to 11.3.
After upgrading the driver , Follow the previous steps to create an isolated environment , in the future cuda cudnn And so on , There is no need to modify the environment variables , I am very tired of the process of changing environment variables .
If there are still problems in building the environment and creating separate folders , You can read the first article yolov5 Environment quickly created articles
https://blog.csdn.net/buaaweibin/article/details/125356544?spm=1001.2014.3001.5502
Open below pytorch Website
You can choose 11.0 edition , But the front cpu It was said during the test 11.0 Compatibility is not good , There will be a path error prompt after the training . I suggest 1.8.0 edition , Of course 9 10 Version can also test the following .
Go to the previous version page .
You can see , There are basically two methods for online installation
One is conda One is pip
conda Method support to cuda 11.3 pip Support to 11.1 The two methods pytorch Same version , Corresponding torchvision torchaudio The version of is also slightly different . But there is no problem installing according to the corresponding version .
It's starting to work conda For installation cuda 11.3
conda install pytorch==1.10.1 torchvision==0.11.2 torchaudio==0.10.1 cudatoolkit=11.3 -c pytorch -c conda-forge
The results are installed in pytorch1.10 when ( Or other versions ) Very slow , Need about 2 In hours or so .
I used pip edition
pip install torch==1.8.0+cu111 torchvision==0.9.0+cu111 torchaudio==0.8.0 -f https://download.pytorch.org/whl/torch_stable.html
from pytorch Official website installation , Very fast ,2 Finish loading in minutes , After that, you may be prompted that some dependencies are not installed , It doesn't matter. We can test it first pytorch and GPU
It shocked me ,gpu The environment has been built , In fact, it can be found during installation , Installed version pytorch It's with cuda and cudnn Of .
The following routine is the same as before , hold yolov5-master decompression ( The previous image has been unzipped ), Then install dependencies in the current directory
pip install -r requirements.txt
After installation , The environment is set up , Let's test first coco128 Data set training , Get into yolov5-master Folder , perform
python train.py --img 640 --batch 16 --epochs 5 --data ./data/coco128.yaml --cfg ./models/yolov5s.yaml --weights yolov5s.pt
There is an error , The page file is too small
because cpu There are no mistakes in training , It can be associated with GPU The existing is too small , Can reduce batch solve
python train.py --img 640 --batch 2 --epochs 5 --data ./data/coco128.yaml --cfg ./models/yolov5s.yaml --weights yolov5s.pt
Start training , Correctly identify GPU
During the training, you can see gpu Video memory usage , monitor cpu You can find cpu Very low occupancy
At the same time, the speed has increased a lot , All in all, only 4 minute .CPU Training should be 20 Minutes or more .
Use the low-end graphics card to complete gpu I didn't have much hope for it , The following research will rely on GTX1070 8G and RTX2060s 8G Graphics card to complete , We'll see .
边栏推荐
- Convert verification code image to tfrecord file
- Exploration of webots and ROS joint simulation (II): model import
- [QNX Hypervisor 2.2用户手册]12.2 术语(二)
- Section IV HQL execution process
- Graduation thesis management system based on SSM
- 修复小程序富文本组件不支持video视频封面、autoplay、controls等属性问题
- 【程序的编译和预处理】
- Speckle denoising method for ultrasonic image
- [unity mirror] use of networkteam
- Exploration of webots and ROS joint simulation (I): software installation
猜你喜欢
Partial summary of 45 lectures on geek time MySQL
什么是乐观锁,什么是悲观锁
MySQL在服务里找不到(未卸载)
Yolov5进阶之三训练环境
Object extraction_ nanyangjx
Detailed explanation of traditional image segmentation methods
微信小程序如何转换成百度小程序
直播回顾 | smardaten李鸿飞解读中国低/无代码行业研究报告:风向变了
Exploration of webots and ROS joint simulation (I): software installation
Section IV HQL execution process
随机推荐
Graduation thesis management system based on SSM
Selenium builds cookies pool to bypass authentication and anti crawl login
Google Chrome collection
Yolov5进阶之三训练环境
Games104 Lecture 12 游戏引擎中的粒子和声效系统
Drawing with MATLAB (1)
1.Intro_ Math (white board derivation and reprint of station B)
20220623 Adobe Illustrator入门
MySQL在服务里找不到(未卸载)
Exploration of webots and ROS joint simulation (II): model import
Intra class data member initialization of static const and static constexpr
Formula understanding in quadruped control
1.20 study univariate linear regression
力扣399【除法求值】【并查集】
Machine learning (Part 1)
【300+精选大厂面试题持续分享】大数据运维尖刀面试题专栏(一)
Autoregressive model of Lantern Festival
Efficiency thesis Reading 1
ImportError: ERROR: recursion is detected during loading of “cv2“ binary extensions. Check OpenCV in
Mongodb分片环境搭建和验证(redis期末大作业)