当前位置:网站首页>Run Yolo v5-5.0 and report an error. If the sppf error cannot be found, solve it

Run Yolo v5-5.0 and report an error. If the sppf error cannot be found, solve it

2022-07-07 17:41:00 AI cannon fodder

First find yolov5 Below models Under the folder common.py file , As shown below :

Find the folder below SPP class ,

  Then add SPPF class , As shown below ,

class SPPF(nn.Module):
    def __init__(self, c1, c2, k = 5):
        super().__init__()
        c_ = c1 // 2
        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')
            y1 = self.m(x)
            y2 = self.m(y1)
            return self.cv2(torch.cat([x, y1, y2, self.m(y2)], 1))

  You can directly copy the above code . Then the error is resolved .

原网站

版权声明
本文为[AI cannon fodder]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/188/202207071529539597.html