用法:pc上20ms
aspp = ASPP(320, [3, 6, 9])
input = torch.randn(2, 320, 10, 10)
# torch.onnx.export(pelee_net, input, "pelee_net.onnx", verbose=True)
for i in range(10):
start=time.time()
# x, *shortcuts = net(input)
# print(time.time()-start,x.shape)
start = time.time()
x=aspp(input)
print(2,time.time() - start, x.shape)
from torch.nn import functional as F
class ASPPPooling(nn.Sequential):
def __init__(self, in_channels, out_channels):
super(ASPPPooling, self).__init__(
nn.AdaptiveAvgPool2d(1),
nn.Conv2d(in_channels, out_channels, 1, bias=False),