**
deeplab_v2_vgg
**
下面展示一些 内联代码片
。
import math
import torchvision
import torch
import torch.nn as nn
import torch.nn.functional as F
class DeepLabASPPVGG(nn.Module):
"""Adapted from official implementation:
http://liangchiehchen.com/projects/DeepLabv2_vgg.html
"""
def __init__(self, n_channels, n_classes, bilinear=True):
super(DeepLabASPPVGG, self).__init__()
self.n_channels = n_channels
self.n_classes = n_classes
self.bilinear = bilinear
features = []
features.append(nn.Conv2d(n_channels, 64, 3, padding=1))
features.append(nn.ReLU(inplace=True))
features.append(nn.Conv2d(64, 64, 3, padding=1))
features.append(nn.ReLU(inplace=True))
features.append(nn.MaxPool2d(3, stride=2, padding=1, ceil_mode=True))
features.append(nn.Conv2d(64, 128, 3, padding=1))
features.append(nn.ReLU(inplace=True))
features.append(nn.Conv2d(128, 128, 3, padding=1))
features.append(nn.ReLU(inplace=True))
features.append(nn.MaxPool2d(3, stride=2, padding=1, ceil_mode=True))
features.append(nn.Conv2d(128, 256, 3, padding=1))
features.append(nn.ReLU(inplace=True))
features.append(nn.Conv2d(256, 256, 3, padding=1))
features.append(nn.ReLU(inplace=True))
features.append(nn.Conv2d(256, 256, 3, padding=1))
features.append(nn.ReLU(inplace=True))
features.append(nn.MaxPool2d(3, stride=2, padding=1, ceil_mode=True))
features.append(nn.Conv2d(256, 512, 3, padding=1))
features.append(nn.ReLU(inplace=True))
features.append(nn.Conv2d(512, 512, 3, padding=1))
features.append(nn.ReLU(inplace=True))
features.append(nn.Conv2d(512, 512, 3, padding=1))
features.append(nn.ReLU(inplace=True))
features.append(nn.MaxPool2d(3, stride=1, padding=1, ceil_mode=True))
features.append(nn.Conv2d(512, 512, 3, padding=2, dilation=2))
features.append(nn.ReLU(inplace=True))
features.append(nn.Conv2d(512, 512, 3, padding=2, dilation=2))
features.append(nn.ReLU(inplace=True))
features.append(nn.Conv2d(512, 512, 3, padding=2, dilation=2))
features.append(nn.ReLU(inplace