update models/common.py for Conv() flexible padding
parent
b8557f87e3
commit
e071b8dd3a
|
@ -13,7 +13,8 @@ class Conv(nn.Module):
|
|||
# Standard convolution
|
||||
def __init__(self, c1, c2, k=1, s=1, g=1, act=True): # ch_in, ch_out, kernel, stride, groups
|
||||
super(Conv, self).__init__()
|
||||
self.conv = nn.Conv2d(c1, c2, k, s, k // 2, groups=g, bias=False)
|
||||
p = k // 2 if isinstance(k, int) else [x // 2 for x in k] # padding
|
||||
self.conv = nn.Conv2d(c1, c2, k, s, p, groups=g, bias=False)
|
||||
self.bn = nn.BatchNorm2d(c2)
|
||||
self.act = nn.LeakyReLU(0.1, inplace=True) if act else nn.Identity()
|
||||
|
||||
|
|
Loading…
Reference in New Issue