NLP进阶之(七)膨胀卷积神经网络
1. Dilated Convolutions 膨胀卷积神经网络
1.2 动态理解
1.2.2 转置卷积动画
1.2.3 理解
2. Dilated Convolutions 优点
3. 应用

理论来自Multi-scale context aggregation by dilated convolutions ICLR 2016
作者将代码贡献于github
针对语义分割问题 semantic segmentation,这里使用 dilated convolutions 得到multi-scale context 信息来提升分割效果。
1. Dilated Convolutions 膨胀卷积神经网络
dilated convolutions:
首先来看看膨胀卷积 dilated convolutions,

图(a):就是一个常规的3x3卷积,1-dilated convolution得到F1,F1的每个位置的卷积感受眼是3x3=9。
图(b):在F1的基础上,进行一个2-dilated convolution,注意它的点乘位置,不是相邻的3x3,得到了F2,F2的每个位置的 卷积感受眼是7x7=49。
图©:在F2的基础上,进行一个4-dilated convolution,得到了F3,F3的每个位置的卷积感受眼是15×15=225,注意这里dilated convolution的参数数量是相同的,都是 3x3=9。

从上图中可以看出,卷积核的参数个数保持不变,卷积感受眼的大小随着dilation rate参数的增加呈指数增长。
1.2 动态理解
N.B.: Blue maps are inputs, and cyan maps are outputs.

1.2.2 转置卷积动画
N.B.: Blue maps are inputs, and cyan maps are outputs.

1.2.3 理解
shape of input : [batch, in_height, in_width, in_channels]
shape of filter : [filter_height, filter_width, in_channels, out_channels]

with tf.variable_scope("idcnn" if not name else name):
#shape=[1*3*120*100]
shape=[1, self.filter_width, self.embedding_dim,
self.num_filter]
print(shape)
filter_weights = tf.get_variable(
"idcnn_filter",
shape=[1, self.filter_width, self.embedding_dim,
self.num_filter],
initializer=self.initializer)
layerInput = tf.nn.conv2d(model_inputs,
filter_weights,
# 上下都是移动一步
strides=[1, 1, 1, 1],
padding="SAME",
name="init_layer",use_cudnn_on_gpu=True)
self.layerInput_test=layerInput
finalOutFromLayers = []

totalWidthForLastDim = 0
# 第一次卷积结束后就放入膨胀卷积里面进行卷积
for j in range(self.repeat_times):
for i in range(len(self.layers)):
#1,1,2:1是步长,2就是中间插了一个孔
dilation = self.layers[i]['dilation']
isLast = True if i == (len(self.layers) - 1) else False
with tf.variable_scope("atrous-conv-layer-%d" % i,
reuse=True
if (reuse or j > 0) else False):
#w 卷积核的高度,卷积核的宽度,图像通道数,卷积核个数
w = tf.get_variable(
"filterW",
shape=[1, self.filter_width, self.num_filter,
self.num_filter],
initializer=tf.contrib.layers.xavier_initializer())
if j==1 and i==1:
self.w_test_1=w
if j==2 and i==1:
self.w_test_2=w
b = tf.get_variable("filterB", shape=[self.num_filter])
conv = tf.nn.atrous_conv2d(layerInput,
w,
rate=dilation,
padding="SAME")
self.conv_test=conv
conv = tf.nn.bias_add(conv, b)
conv = tf.nn.relu(conv)
if isLast:
finalOutFromLayers.append(conv)
totalWidthForLastDim += self.num_filter
layerInput = conv
finalOut = tf.concat(axis=3, values=finalOutFromLayers)
keepProb = 1.0 if reuse else 0.5
finalOut = tf.nn.dropout(finalOut, keepProb)
finalOut = tf.squeeze(finalOut, [1])
finalOut = tf.reshape(finalOut, [-1, totalWidthForLastDim])
self.cnn_output_width = totalWidthForLastDim
return finalOut
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
2. Dilated Convolutions 优点
3. 应用
扩张卷积在图像分割、语音合成、机器翻译、目标检测中都有应用。
---------------------
作者:Merlin17Crystal33
来源:CSDN
原文:https://blog.csdn.net/qq_35495233/article/details/86638098
版权声明:本文为博主原创文章,转载请附上博文链接!

NLP进阶之(七)膨胀卷积神经网络相关推荐

  1. 膨胀卷积神经网络_用膨胀的卷积神经网络生成钢琴音乐

    膨胀卷积神经网络 介绍 (Introduction) Fully convolutional neural networks consisting of dilated 1D convolutions ...

  2. TensorFlow神经网络(七)卷积神经网络基础

    [注]内容来自MOOC人工智能实践TensorFlow笔记课程第七讲第一课 https://www.icourse163.org/learn/PKU-1002536002?tid=1002700003 ...

  3. 温州大学《深度学习》课程课件(七、卷积神经网络基础)

    这学期我上的另一门课是本科生的<深度学习>,主要用的是吴恩达老师的<深度学习>视频课的内容. 使用教材:吴恩达<深度学习>课程笔记 课外参考书:<深度学习&g ...

  4. 机器学习-初级进阶(深度学习-卷积神经网络)

    一.卷积神经网络 卷积神经网络介绍 学习资料 卷积神经网络流程分解 (1)卷积: 卷积后的几种照片展示图: (2)最大池化 (3)扁平化 (4)全连接层 线性整流激活层 线性整流层资料 总结 代码实现 ...

  5. 第七章 卷积神经网络2(代码实现)

    文章目录 7.1卷积层和池化层实现 7.1.1 4维数组 7.1.2基于im2col的展开 7.1.3卷积层的实现 7.1.4池化层的是实现 7.2CNN实现 7.2.1目录结构如下: 7.2.2结果 ...

  6. 深度学习笔记(三十一)三维卷积及卷积神经网络

    一.RGB三维图像的卷积 首先复习以下二维卷积运算的过程: 然后让我们看看三维图像如何进行有效的卷积运算. 计算方法和二维卷积类似,从三维图像中划分出3×3×33\times3\times33×3×3 ...

  7. 【NLP】毕设学习笔记(七)前馈神经网络代表者——卷积神经网络无公式理解

    含隐藏层的全连接前馈神经网络图: 加入隐藏层而非只有输入层和输出层的原因: 如果不加入隐藏层,则在进行最终的判断时,输入层的每一个数据都和输出结果直接挂钩,但事实上,这样的挂钩是十分不可靠的. 例如, ...

  8. 深度学习与自然语言处理教程(8) - NLP中的卷积神经网络(NLP通关指南·完结)

    作者:韩信子@ShowMeAI 教程地址:https://www.showmeai.tech/tutorials/36 本文地址:https://www.showmeai.tech/article-d ...

  9. 斯坦福NLP名课带学详解 | CS224n 第11讲 - NLP中的卷积神经网络(NLP通关指南·完结)

    作者:韩信子@ShowMeAI,路遥@ShowMeAI,奇异果@ShowMeAI 教程地址:https://www.showmeai.tech/tutorials/36 本文地址:https://ww ...

最新文章

  1. MySQL中truncate误操作后的数据恢复案例
  2. 弄了个调试呼叫中心用的小机器
  3. Ajax请求中的async:false/true的作用
  4. DSP、ARM和单片机的区别
  5. oracle协议适配器错误tns,ORA-12560: TNS: 协议适配器错误 常见原因
  6. springMVC4(14)各类视图输出实例分析
  7. apache服务器进程配置文件是,apache服务器进程配置文件是
  8. 普通函数和Generator函数递归获取嵌套数组的最大值
  9. FCPX内置音效库汉化版
  10. 2021年优秀网络虚拟化解决方案
  11. 傅里叶变换【2】:傅里叶幅度谱与相位谱
  12. gb和gib的区别_内存 G和GB有什么区别
  13. Java实验9 矩形类的定义与封装
  14. 服务器要删除文件访问被拒绝,删除文件提示:文件夹访问被拒绝 需要来自administrator权限执行操作...
  15. mysqllinux操作,万字解析!
  16. html 的ul是块矿元素吗,食品化学题库单选判断
  17. hadoop重命名文件_hadoop HDFS常用文件操作命令
  18. 1218:取石子游戏
  19. 去哪儿网BI平台建设演进与实践
  20. flv 文件格式解析

热门文章

  1. 2022-2028年中国聚硫橡胶行业市场研究及前瞻分析报告
  2. 前端Vue学习之路(一)-初识Vue
  3. 2021年华为与小康-北汽-长安
  4. TVM性能评估分析(一)
  5. Tengine Web服务器概述
  6. BERT模型的OneFlow实现
  7. RESTful API 最佳实践
  8. [JS][dfs]题解 | #迷宫问题#
  9. AttributeError: ‘NoneType‘ object has no attribute ‘group‘
  10. Python : IndentationError: expected an indented block