yolov8 face 錯誤修改

WenJXUST發表於2024-08-07

derronqi/yolov8-face: yolov8 face detection with landmark (github.com)

問題:訓練yolov8-lite-s,yolov8-lite-t的時候會出錯,Cannot use yolov8-lite-s · Issue #3 · derronqi/yolov8-face (github.com)

TypeError: conv2d() received an invalid combination of arguments - got (Tensor, Parameter, Parameter, tuple, tuple, tuple, int), but expected one of:
 * (Tensor input, Tensor weight, Tensor bias, tuple of ints stride, tuple of ints padding, tuple of ints dilation, int groups)
      didn't match because some of the arguments have invalid types: (Tensor, Parameter, Parameter, tuple of (int, int), tuple of (int, int), tuple of (bool, bool), int)
 * (Tensor input, Tensor weight, Tensor bias, tuple of ints stride, str padding, tuple of ints dilation, int groups)
      didn't match because some of the arguments have invalid types: (Tensor, Parameter, Parameter, tuple of (int, int), tuple of (int, int), tuple of (bool, bool), int)

原因:conv引數沒有匹配上,如下:

改原始碼"ultralytics\nn\modules\block.py",line 42

class StemBlock(nn.Module):
    def __init__(self, c1, c2, k=3, s=2, p=None, g=1,d=1, act=True):
        super(StemBlock, self).__init__()
        self.stem_1 = Conv(c1, c2, k, s, p, g, d, act)
        self.stem_2a = Conv(c2, c2 // 2, 1, 1, 0)
        self.stem_2b = Conv(c2 // 2, c2, 3, 2, 1)
        self.stem_2p = nn.MaxPool2d(kernel_size=2,stride=2,ceil_mode=True)
        self.stem_3 = Conv(c2 * 2, c2, 1, 1, 0)

解決。

相關文章