Tag Archives: AttributeError: Can‘t get attribute SPPF on module models

[Solved] YOLO v5 Error: AttributeError: Can‘t get attribute SPPF on module models

When running the detect.py program of yolov5, the following error prompt attributeerror appears: can’t get attribute sppf on module models. Common from D:// yolov\ yolov5-5.0\ odels\common.py**

2. Solution

    1. Download yolov6 in GitHub, open the file and find the models folder:

    1. find common.py in the models folder, open it and use the search sppf keyword to find the sppf class in the file, and replace the following code with it:
 class SPPF(nn.Module):  # export-friendly version of nn.SiLU()
    @staticmethod
    def forward(x):
        return x * torch.sigmoid(x)

Problem-solving: