当前位置:网站首页>[YOLOv5] 6.0 environment construction (updated from time to time)
[YOLOv5] 6.0 environment construction (updated from time to time)
2022-08-08 23:08:00 【The swaying tree】
引言
笔者YOLOv5专栏链接导航:
The author has always been very partialyolov5系列,Because it is very friendly,上手容易,Compatibility is also relatively high(There won't be many demanding requirements,Especially for training hardware configuration),From building the environment to training to application,都非常简便.Let users spend more time on coordination and improvement of actual application scenarios.
yolov5的最新版本6.1
源码:https://github.com/ultralytics/yolov5/tree/v6.1
Some updated information notes:https://github.com/ultralytics/yolov5/releases/tag/v6.1Author update date : 2022.3.2
1.环境搭建
conda create -n yolov5-6 python=3.7
conda activate yolov5-6
官网的安装教程:
Generally run to downloadtorch会非常慢,So it is best to install it separately firsttorch
The author's installation instruction flow is as follows:
git clone https://github.com/ultralytics/yolov5 # 1
cd yolov5 # 2
pip install -r requirements.txt # 3
Follow the prompts to decide which version to install,如上图所示
官网安装命令 https://pytorch.org/get-started/locally/
# 单独安装pythorch(gpu版本)
install torch==1.10.2+cu102 torchvision==0.11.3+cu102 torchaudio===0.10.2+cu102 -f https://download.pytorch.org/whl/cu102/torch_stable.html # 4
# Run the official installation instructions again,At this point the installation will be much faster
pip install -r requirements.txt # 5
If other necessary libraries are encountered, the download is very slow,Then you can install and use the mirror source separately
pip install xxx -i https://pypi.tuna.tsinghua.edu.cn/simple
pip install xxx -i https://pypi.douban.com/simple
# 然后再
pip install -r requirements.txt
requirements.txt的内容如下:
2.下载预训练模型
链接(Scroll to the bottom of the page):预训练模型
3. 推理
任意新建一个.py文件,写入如下的代码,在终端运行
import torch
# Model
model = torch.hub.load('ultralytics/yolov5', 'yolov5s') # or yolov5m, yolov5x, custom
# Images
# img = 'https://ultralytics.com/images/zidane.jpg' # or file, PIL, OpenCV, numpy, multiple
img = 'data/images/zidane.jpg'
# Inference
results = model(img)
# Results
results.print() # or .show(), .save(), .crop(), .pandas(), etc.
显示结果为:
4. 测试
--project指定保存路径;--weights指定测试模型
python detect.py --source data/images/zidane.jpg --weights v5_pre_models/yolov5s.pt --project out --img-size 640
边栏推荐
猜你喜欢

用工具实现 Mock API 的整个流程

PMP考点有哪些啊?
![微信小程序错误 undefined Expecting ‘STRING‘,‘NUMBER‘,‘NULL‘,‘TRUE‘,‘FALSE‘,‘{‘,‘[‘, got ]解决方案](/img/31/a9b0c31f648d41e300949ac43c5cab.png)
微信小程序错误 undefined Expecting ‘STRING‘,‘NUMBER‘,‘NULL‘,‘TRUE‘,‘FALSE‘,‘{‘,‘[‘, got ]解决方案

【Bug解决】ValueError: Object arrays cannot be loaded when allow_pickle=False

bp神经网络的学习心得

虚拟化类型(配图)

【CUDA】version switch freely

STM8L 液晶数码管驱动,温度计液晶屏显示

考证必看 | PMP扫盲贴+PMP材料

(2022牛客多校五)C-Bit Transmission(思维)
随机推荐
(2022牛客多校五)G-KFC Crazy Thursday(二分+哈希/Manacher)
ndk和JNI的使用初探
Kubernetes 实现 CI/CD 发布流程
容斥原理
用工具实现 Mock API 的整个流程
(newcoder 15079)无关(容斥原理)
The second side of Tencent technical support internship - Tencent's father's luck is so sudden (offer received)
(2022牛客多校四)H-Wall Builder II(思维)
考证必看 | PMP扫盲贴+PMP材料
(2022牛客多校三)A-Ancestor(LCA)
wps表格分两页断开怎么办?wps表格分两页断开的解决方法
设计分享|基于单片机的P0口驱动LED闪烁
Analysis of WLAN - Wireless Local Area Network
Tp5 in cache cache, storage cell phone text message authentication code
flutter 书写json解析类
-Wl,--start-group ... -Wl,--end-group for resolving circular dependencies of several libraries
JS中的原型与原型链
影响你各应用间网速的QoS你了解吗?
Qt入门(五)——文件操作、热键和鼠标的读取(txt窗口的实现)
2021 RoboCom 世界机器人开发者大赛-本科组(决赛)7-1绿色围栏(模拟)