yolov5一些奇奇怪怪的报错解决方案

ValueError: check_hostname requires server_hostname

原因:开了某种加速器,把加速器关了

UnicodeDecodeError: 'gbk' codec can't decode byte 0xac in position 49: illegal multibyte sequence


pip install -r requirement.txt额 没事闲的手欠在人家写的文档里瞎搞写注释报错,把自己的注释删掉

RuntimeError: The size of tensor a (80) must match the size of tensor b (56) at non-singleton dimension 3

解决方法:https://github.com/ultralytics/yolov5/releases/download/v5.0/yolov5s.pt
将其中的yolov5s.pt替换掉 个人建议安装之前版本的yolo最好自己下载其中releases中的yolov5s.pt和yolov5m.pt放到yolo的文件夹下

AttributeError: Can‘t get attribute ‘SPPF‘ on <module ‘models.common‘ from XXXX/model/common.py 作者:专治药丸 https://www.bilibili.com/read/cv14568709 出处:bilibili
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))

在出错的文件夹下复制以下代码
在train.py文件下进行调试时注意如果遇到

Exception: train: Error loading data from ../coco128/images/train2017/: trai

这种错误时,手动到yolo文件夹下将coco128zip进行解压,并将yolov5\yolov5-5.0\data目录下的coco128.yaml内容更改为相应的解压后的路径
在这里插入图片描述

你可能感兴趣的:(opencv,计算机视觉,人工智能,pytorch)