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))
Modified in moudle commom.py
Read More:
- AttributeError: Can‘t get attribute ‘LeNet‘ on <module ‘__ main__ “From (error in torch loading model)
- KeyError: “Can‘t open attribute (can‘t locate attribute: ‘nrx‘)“
- [learning opengl 22 step by step] – OpenGL importing 3D models with assimp Library
- Using onnx to deploy models in mmdetection
- TypeError(‘Keyword argument not understood:‘, ‘***‘) in keras.models load_model
- Python2 PicklingError: Can‘t pickle <type ‘instancemethod‘>: attribute lookup __builtin__.instanceme
- Attributeerror: ‘module’ object has no attribute ‘handlers’ — Python sub module import problem
- AttributeError: module ‘torch’ has no attribute’_six’ [The problem is solved after restart]
- Attributeerror: module “Seaborn” has no attribute “lineplot”
- AttributeError: module…ops‘ has no attribute ‘_TensorLike‘, ValueError: `updates` argument..eager
- How to Solve Yolov5 Common Error (Three Errors)
- [error] attributeerror: module ‘SIP’ has no attribute ‘setapi‘
- Attributeerror: module tensorflow no attribute app solution
- Solve the problem of attributeerror: module ‘SciPy’ has no attribute ‘Stats’
- AttributeError: module ‘keras.backend‘ has no attribute ‘eager‘
- Solving attributeerror: module ‘urllib’ has no attribute ‘request’
- Solving attributeerror: module ‘Matplotlib’ has no attribute ‘artist’
- AttributeError: module ‘os’ has no attribute ‘mknod’
- Pytorch — nn.Sequential () module
- AttributeError: module ‘onnxruntime‘ has no attribute ‘InferenceSession‘