当前位置:网站首页>Deploy yolov5 error reporting in pycharm
Deploy yolov5 error reporting in pycharm
2022-07-27 00:16:00 【Ap21ril】
stay pycharm Deployment in China yolov5 Report the wrong question
Preface
Everyone is studying yolov5 When , The first is to deploy it to your own IDE Come on. , But there are two problems when I deploy , It took a lot of time to solve , So write it down .
One 、 No, SPPF function
stay yolov5 There is no SPPF function , This is actually a source code problem , Only need to yolov6 download , And then in models In the directory commns.py file , Copy it SPPF Class to yolov5 Then you can , It should be noted that , After copying , Still need to be in yolov5 Of commns.py Import a package from . If you don't want to download again yolov6, You can directly copy the code here .
The relevant code is as follows
import warnings
class SPPF(nn.Module):
# Spatial Pyramid Pooling - Fast (SPPF) layer for YOLOv5 by Glenn Jocher
def __init__(self, c1, c2, k=5): # equivalent to SPP(k=(5, 9, 13))
super().__init__()
c_ = c1 // 2 # hidden channels
self.cv1 = Conv(c1, c_, 1, 1)
self.cv2 = Conv(c_ * 4, c2, 1, 1)
self.m = nn.MaxPool2d(kernel_size=k, stride=1, padding=k // 2)
def forward(self, x):
x = self.cv1(x)
with warnings.catch_warnings():
warnings.simplefilter('ignore') # suppress torch 1.9.0 max_pool2d() warning
y1 = self.m(x)
y2 = self.m(y1)
return self.cv2(torch.cat([x, y1, y2, self.m(y2)], 1))
Two 、pycocotools Installation error
This problem is more difficult for beginners to solve , Some bloggers say download VS And then restart pycharm You can download it smoothly pycocotools. I also tried this method ,VS Too big to say , As a result, it still doesn't work after downloading , one 's heart is like dead ashes -- utterly dissipated . Of course, it's not that this method can't , After all, some bloggers say it can be solved , It may be the problem of my operation .
terms of settlement
The key is coming. , I'll download it directly for you pycocotools File alas , You can directly unzip and copy it to the directory of the corresponding environment , Who says there is no shortcut , Ha ha ha . See the end of the article for the file download link .
Take the environment I configured as an example :
1. take pycocotools After unzipping, there will be two folders 
2. Copy both folders to your environment Lib Under the table of contents .
I am a anaconda Next new one pytorch A virtual environment , If your anaconda It is installed in the default location , That should be the same as my operation , If not , Please open your anaconda The installation directory .

Then enter envs Under the table of contents ,envs It's the folder of the virtual environment , Find your virtual environment , I am here pytorch.
Get into pytorch Under the table of contents , And open Lib Catalog 
Copy the two folders here and you're done .
To prevent someone github cannot access , I saved the file gitee On
https://gitee.com/peng-chongle/pycocotools
边栏推荐
- Several search terms
- push to origin/master was rejected 错误解决方法
- LeetCode题目——二叉树篇
- Add an article ----- scanf usage
- Codeforces C1. Simple Polygon Embedding
- Dynamic SQL
- Arthas quick start
- Azure synapse analytics Performance Optimization Guide (3) -- optimize performance using materialized views (Part 2)
- Tree and binary tree (learning notes)
- Meeting OA my meeting
猜你喜欢

知识蒸馏——pytorch实现

01 knapsack problem 416. Segmentation and equal sum subset -494. Goal and

动态sql

Midge paper reading notes

C and pointer Chapter 18 runtime environment 18.1 judgment of runtime environment

买不到的数目

卷积神经网络——LeNet(pytorch实现)

push to origin/master was rejected 错误解决方法

Practice of data storage scheme in distributed system

Practice of intelligent code reconstruction of Zhongyuan bank
随机推荐
Qunar travel massive indicator data collection and storage
文件上传到服务器
【C语言】经典的递归问题
13_ conditional rendering
deeplabcut使用1
14_ Basic list
ES6新特性
Embedded system migration [8] - device tree and root file system migration
AlexNet(Pytorch实现)
第2章 开发用户流量拦截器
蒙着头配置deeplabcut2
PTA 7-3 lists leaf nodes
What scenarios are Tencent cloud lightweight application servers suitable for?
动态sql
三层架构 模拟
Design of vision protector based on 51 single chip microcomputer
LeetCode题目——数组篇
C语言数组
MySQL transaction, phantom reading, current reading, snapshot reading related notes
New features of ES6