资源简介
resnet-pytorch
代码片段和文件信息
from __future__ import print_function
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
# PyTorch implementation of Dilated Residual Network
def conv3x3(planes):
‘‘‘ 3x3 convolution ‘‘‘
return nn.Conv2d(planes planes kernel_size=(33) padding=(11) bias=False)
class ResBasicBlock(nn.Module):
‘‘‘ basic Conv2D Block for ResNet ‘‘‘
def __init__(self planes):
super(ResBasicBlock self).__init__()
self.bn1 = nn.BatchNorm2d(planes)
self.re1 = nn.ReLU(inplace=True)
self.cnn1 = conv3x3(planes)
self.bn2 = nn.BatchNorm2d(planes)
self.re2 = nn.ReLU(inplace=True)
self.cnn2 = conv3x3(planes)
def forward(self x):
residual = x
x = self.cnn2(self.re2(self.bn2(self.cnn1(self.re1(self.bn1(x))))))
x += residual
return x
class SpoofSmallResNet256_400(nn.Module):
‘‘‘ small ResNet for 256 by 400 feature map (same NN as SpoofSm
- 上一篇:python 购物金额计算
- 下一篇:python浅拷贝、深拷贝
评论
共有 条评论