9大主題卷積神經(jīng)網(wǎng)絡(CNN)的PyTorch實現(xiàn)

極市導讀
?從R-CNN到YOLO v3再到M2Det,近年來的目標檢測新模型層出不窮,性能也越來越好。本文介紹了它們的PyTorch實現(xiàn),目前Github已開源,非常實用。>>就在明天,極市直播:極市直播丨張志鵬:Ocean/Ocean+: 實時目標跟蹤分割算法,小代價,大增益|ECCV2020

1 典型網(wǎng)絡(Classical network)


import torchimport torch.nn as nndef Conv3x3BNReLU(in_channels,out_channels,stride,padding=1):return nn.Sequential(nn.Conv2d(in_channels=in_channels, out_channels=out_channels, kernel_size=3, stride=stride, padding=1),nn.BatchNorm2d(out_channels),nn.ReLU6(inplace=True))def Conv1x1BNReLU(in_channels,out_channels):return nn.Sequential(nn.Conv2d(in_channels=in_channels, out_channels=out_channels, kernel_size=1, stride=1, padding=0),nn.BatchNorm2d(out_channels),nn.ReLU6(inplace=True))def ConvBNReLU(in_channels,out_channels,kernel_size,stride,padding=1):return nn.Sequential(nn.Conv2d(in_channels=in_channels, out_channels=out_channels, kernel_size=kernel_size, stride=stride, padding=padding),nn.BatchNorm2d(out_channels),nn.ReLU6(inplace=True))def ConvBN(in_channels,out_channels,kernel_size,stride,padding=1):return nn.Sequential(nn.Conv2d(in_channels=in_channels, out_channels=out_channels, kernel_size=kernel_size, stride=stride, padding=padding),nn.BatchNorm2d(out_channels))class ResidualBlock(nn.Module):def __init__(self, in_channels, out_channels):super(ResidualBlock, self).__init__()mid_channels = out_channels//2self.bottleneck = nn.Sequential(ConvBNReLU(in_channels=in_channels, out_channels=mid_channels, kernel_size=1, stride=1),ConvBNReLU(in_channels=mid_channels, out_channels=mid_channels, kernel_size=3, stride=1, padding=1),ConvBNReLU(in_channels=mid_channels, out_channels=out_channels, kernel_size=1, stride=1),)self.shortcut = ConvBNReLU(in_channels=in_channels, out_channels=out_channels, kernel_size=1, stride=1)def forward(self, x):out = self.bottleneck(x)return out+self.shortcut(x)
2?輕量級網(wǎng)絡(Lightweight)










7?人體姿態(tài)識別網(wǎng)絡(HumanPoseEstimation)

8?注意力機制網(wǎng)絡

9 人像分割網(wǎng)絡(PortraitSegmentation)
推薦閱讀
通道注意力超強改進,輕量模塊ECANet來了!即插即用,顯著提高CNN性能|已開源 憑什么相信你,我的CNN模型?關于CNN模型可解釋性的思考 深度學習準「研究僧」預習資料:圖靈獎得主Yann LeCun《深度學習(Pytorch)》春季課程

評論
圖片
表情
