资源简介
Attention-CNN
注意力机制细腻度图片分类。
ResNet改造
代码片段和文件信息
import mxnet as mx
import proposal
import proposal_target
from rcnn.config import config
eps = 2e-5
use_global_stats = True
workspace = 512
res_deps = {‘50‘: (3 4 6 3) ‘101‘: (3 4 23 3) ‘152‘: (3 8 36 3) ‘200‘: (3 24 36 3)}
units = res_deps[‘101‘]
filter_list = [256 512 1024 2048]
def residual_unit(data num_filter stride dim_match name):
bn1 = mx.sym.BatchNorm(data=data fix_gamma=False eps=eps use_global_stats=use_global_stats name=name + ‘_bn1‘)
act1 = mx.sym.Activation(data=bn1 act_type=‘relu‘ name=name + ‘_relu1‘)
conv1 = mx.sym.Convolution(data=act1 num_filter=int(num_filter * 0.25) kernel=(1 1) stride=(1 1) pad=(0 0)
no_bias=True workspace=workspace name=name + ‘_conv1‘)
bn2 = mx.sym.BatchNorm(data=conv1 fix_gamma=False eps=eps use_global_stats=use_global_stats name=name + ‘_bn2‘)
act2 = mx.sym.Activation(data=bn2 act_type=‘relu‘ name=name + ‘_relu2‘)
conv2 = mx.sym.Convolution(data=act2 num_filter=int(num_filter * 0.25) kernel=(3 3) stride=stride pad=(1 1)
no_bias=True workspace=workspace name=name + ‘_conv2‘)
bn3 = mx.sym.BatchNorm(data=conv2 fix_gamma=False eps=eps use_global_stats=use_global_stats name=name + ‘_bn3‘)
act3 = mx.sym.Activation(data=bn3 act_type=‘relu‘ name=name + ‘_relu3‘)
conv3 = mx.sym.Convolution(data=act3 num_filter=num_filter kernel=(1 1) stride=(1 1) pad=(0 0) no_bias=True
workspace=workspace name=name + ‘_conv3‘)
if dim_match:
shortcut = data
else:
shortcut = mx.sym.Convolution(data=act1 num_filter=num_filter kernel=(1 1) stride=stride no_bias=True
workspace=workspace name=name + ‘_sc‘)
sum = mx.sym.ElementWiseSum(*[conv3 shortcut] name=name + ‘_plus‘)
return sum
def get_resnet_conv(data):
# res1
data_bn = mx.sym.BatchNorm(data=data fix_gamma=True eps=eps use_global_stats=use_global_stats name=‘bn_data‘)
conv0 = mx.sym.Convolution(data=data_bn num_filter=64 kernel=(7 7) stride=(2 2) pad=(3 3)
no_bias=True name=“conv0“ workspace=workspace)
bn0 = mx.sym.BatchNorm(data=conv0 fix_gamma=False eps=eps use_global_stats=use_global_stats name=‘bn0‘)
relu0 = mx.sym.Activation(data=bn0 act_type=‘relu‘ name=‘relu0‘)
pool0 = mx.symbol.Pooling(data=relu0 kernel=(3 3) stride=(2 2) pad=(1 1) pool_type=‘max‘ name=‘pool0‘)
# res2
unit = residual_unit(data=pool0 num_filter=filter_list[0] stride=(1 1) dim_match=False name=‘stage1_unit1‘)
for i in range(2 units[0] + 1):
unit = residual_unit(data=unit num_filter=filter_list[0] stride=(1 1) dim_match=True name=‘stage1_unit%s‘ % i)
# res3
unit = residual_unit(data=unit num_filter=filter_list[1] stride=(2 2) dim_match=False name=‘stage2_unit1‘)
for i in range(2 units[1] + 1):
相关资源
- 基于卷积神经网络的手写数字识别
- Tensorflow之CNN实现CIFAR-10图像的分类p
- cython_bbox.so
- py-R-FCN的ResNet50和ResNet101预训练模型
- 适合的新手-CNN代码
- CNN网络识别Mnist的源码,有详细注释,
- CNN_源代码
- faster rcnn end-to-end loss曲线的绘制
- 卷积神经网络回归模型
- Python+Tensorflow+CNN实现车牌识别的
- CBAM_MNIST.py
- 利用keras实现的cnn卷积神经网络对手写
- AI智能五子棋Python代码
- CNN卷积神经网络TensorFlow代码
- DeepLab-ResNet-101
- 卷积神经网络(CNN)源码
- Practical Computer Vision Applications Using D
- minist+CNN+交叉验证
- faster Rcnn(python)demo
- keras+tensorflow CNN
- resnet-pytorch
- 基于MTCNN实现制作脸部VOC格式数据集
- mnist_CNN 深度学习小
- 深度学习之一:卷积神经网络(CNN)
- 深度学习之二:用Tensorflow实现卷积神
- MaskR-CNNpython
- CNN实现手写数字识别
- python实现的CNN代码
- 车牌识别Python程序,使用五层的CNN网
- TensorFlow实现CNN
评论
共有 条评论