国产精品天干天干,亚洲毛片在线,日韩gay小鲜肉啪啪18禁,女同Gay自慰喷水

歡迎光臨散文網(wǎng) 會員登陸 & 注冊

yolov5--Can't get attribute 'SPPF' on

2022-04-22 21:14 作者:javaisone  | 我要投稿

測試yolov5時報錯 :

Can't get attribute 'SPPF' on <module 'models.common

解決方法:

到tags的版本V6.0的models 目錄下的common.py目錄復(fù)制類SPPF到報錯的類文件中

同時倒入頭文件 warnings

如下:?

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))

?

還報錯:

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

下載對應(yīng)的v5.0版本的.pt文件,地址如下:

https://github.com/ultralytics/yolov5/releases/download/v5.0/yolov5s.pt

因為默認(rèn)下載的不是v5.0的,所以要重新下載.pt文件。

?

再在運行 detect.py

Ok


yolov5--Can't get attribute 'SPPF' on的評論 (共 條)

分享到微博請遵守國家法律
伊吾县| 天峨县| 汝州市| 克什克腾旗| 长治市| 万安县| 雅安市| 安多县| 彭阳县| 海晏县| 敦煌市| 焉耆| 增城市| 元阳县| 达州市| 贞丰县| 札达县| 班戈县| 鄂温| 会宁县| 花莲市| 刚察县| 玛纳斯县| 共和县| 会东县| 泸州市| 丰城市| 莱西市| 长岭县| 博客| 罗甸县| 冷水江市| 砀山县| 满城县| 阆中市| 南陵县| 黄龙县| 德安县| 岳普湖县| 临清市| 花莲县|