问题描述:
运行yolov5-train.py文件时候,出现问题:
AttributeError: Cant get attribute SPPF on module models.common......(后面是文件路径)
解决办法:
1. 双击打开common.py文件:
2.增加代码:
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