版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1、Convnets in TensorFlowCS 20: TensorFlow for Deep Learning ResearchLecture 72/7/201712AgendaConvolutions without trainingConvnet with MNIST!tf.layers3Understanding convolutions4Convolutions in math and physics5a function derived from two given functions by integration that expresses how the shape of
2、one is modified by the otherConvolutions in math and physics6Brian Amberg derivative work (Wikipedia)Convolutions in math and physics7How an input is transformed by a kernel* *also called filter/feature mapConvolutions in machine learning8We can use one single convolutional layer to modify a certain
3、 imageConvolutions in machine learning9 Kernel for blurring100.06250.1250.06250.1250.250.1250.06250.1250.0625Matrix multiplication of this kernel with a 3 x 3 patch of an image is a weighted sum of neighboring pixels= blurring effectConvolution without training110.06250.1250.06250.1250.250.1250.0625
4、0.1250.0625tf.nn.conv2dinputKernel for blurringoutputConvolutions in TensorFlow12We can use one single convolutional layer to modify a certain imagetf.nn.conv2d( input, filter, strides, padding, use_cudnn_on_gpu=True, data_format=NHWC, dilations=1, 1, 1, 1, name=None)Convolutions in TensorFlow13We c
5、an use one single convolutional layer to modify a certain imagetf.nn.conv2d( input,Batch size (N) x Height (H) x Width (W) x Channels (C) filter,Height x Width x Input Channels x Output Channels strides,4 element 1-D tensor, strides in each direction padding,SAME or VALID use_cudnn_on_gpu=True, data
6、_format=NHWC, dilations=1, 1, 1, 1, name=None)Convolutions in TensorFlow14We can use one single convolutional layer to modify a certain imagetf.nn.conv2d( image, kernel, strides=1, 3, 3, 1, padding=SAME,)Some basic kernels15inputsharpenedgetop sobelembossSee kernels.py and 07_run_kernels.pySome basi
7、c kernels16inputsharpenedgetop sobelembossConvolutions in machine learning17Dont hard-code the values of your kernels.Learn the optimal kernels through training!ConvNet with MNIST18Model1928x28x15x5x1x32Conv + relu28x28x32Maxpool (2x2x1)Conv + reluMaxpool (2x2x1)Fully + reluFully + softmaxWeight5x5x
8、32x647*7*64 x 10241024 x 1014x14x3214x14x647 x 7 x 641 x 10241 x 10Strides for all convolutional layers: 1, 1, 1, 1Convolutional layer2028x28x15x5x1x32Conv + relu28x28x32Maxpool (2x2x1)Conv + reluMaxpool (2x2x1)Fully + reluFully + softmaxWeight5x5x32x647*7*64 x 10241024 x 1014x14x3214x14x647 x 7 x 6
9、41 x 10241 x 10conv = tf.nn.conv2d(images,kernel,strides=1, 1, 1, 1,padding=SAME)Convolutional layer: padding21Input width = 13Filter width = 6Stride = 5Convolutional layer: Dimension2228x28x15x5x1x32Conv + relu28x28x32Maxpool (2x2x1)Conv + reluMaxpool (2x2x1)Fully + reluFully + softmaxWeight5x5x32x
10、647*7*64 x 10241024 x 1014x14x3214x14x647 x 7 x 641 x 10241 x 10(WF+2P)/S+ 1W: input width/depthF: filter width/depthP: paddingS: strideConvolutional layer: Dimension23(WF+2P)/S+ 1W: input width/depthF: filter width/depthP: paddingS: strideImage credit: CS231n Lecture 7Convolutional layer: Dimension
11、2428x28x15x5x1x32Conv + relu28x28x32Maxpool (2x2x1)Conv + reluMaxpool (2x2x1)Fully + reluFully + softmaxWeight5x5x32x647*7*64 x 10241024 x 1014x14x3214x14x647 x 7 x 641 x 10241 x 10(WF+2P)/S+ 1(28 - 5 + 2*2)/1 + 1 = 28W: input width/depthF: filter width/depthP: paddingS: strideConvolutional layer: D
12、imension2528x28x15x5x1x32Conv + relu28x28x32Maxpool (2x2x1)Conv + reluMaxpool (2x2x1)Fully + reluFully + softmaxWeight5x5x32x647*7*64 x 10241024 x 1014x14x3214x14x647 x 7 x 641 x 10241 x 10(WF+2P)/S+ 1(28 - 5 + 2*2)/1 + 1 = 28W: input width/depthF: filter width/depthP: paddingS: strideTF computes pa
13、dding for us!Maxpooling2628x28x15x5x1x32Conv + relu28x28x32Maxpool (2x2x1)Conv + reluMaxpool (2x2x1)Fully + reluFully + softmaxWeight5x5x32x647*7*64 x 10241024 x 1014x14x3214x14x647 x 7 x 641 x 10241 x 10pool1 = tf.nn.max_pool(conv1,ksize=1, 2, 2, 1,strides=1, 2, 2, 1,padding=SAME)Maxpooling27Slide
14、credit: CS231n Lecture 71124567832101234Single depth slicexymax pool with 2x2 filters and stride 26834Maxpooling: Dimension2828x28x15x5x1x32Conv + relu28x28x32Maxpool (2x2x1)Conv + reluMaxpool (2x2x1)Fully + reluFully + softmaxWeight5x5x32x647*7*64 x 10241024 x 1014x14x3214x14x647 x 7 x 641 x 10241
15、x 10(WK+2P)/S+ 1W: input width/depthK: window width/depthP: paddingS: strideMaxpooling: Dimension2928x28x15x5x1x32Conv + relu28x28x32Maxpool (2x2x1)Conv + reluMaxpool (2x2x1)Fully + reluFully + softmaxWeight5x5x32x647*7*64 x 10241024 x 1014x14x3214x14x647 x 7 x 641 x 10241 x 10(WK+2P)/S+ 1(28 - 2 +
16、2*0) / 2 + 1 = 14W: input width/depthK: window width/depthP: paddingS: strideFully connected3028x28x15x5x1x32Conv + relu28x28x32Maxpool (2x2x1)Conv + reluMaxpool (2x2x1)Fully + reluFully + softmaxWeight5x5x32x647*7*64 x 10241024 x 1014x14x3214x14x647 x 7 x 641 x 10241 x 10fc = tf.matmul(pool2, w) +
17、bSoftmax3128x28x15x5x1x32Conv + relu28x28x32Maxpool (2x2x1)Conv + reluMaxpool (2x2x1)Fully + reluFully + softmaxWeight5x5x32x647*7*64 x 10241024 x 1014x14x3214x14x647 x 7 x 641 x 10241 x 10Loss functiontf.nn.softmax_cross_entropy_with_logits(labels=Y, logits=logits)Predicttf.nn.softmax(logits_batch)
18、Interactive coding3207_convnet_mnist_starter.py from GitHub!Update utils.py33Training progress34Test accuracy increases while training loss decreases!Accuracy35EpochsAccuracy10.913120.936330.947850.9573100.971250.9818tf.layers36tf.layers37Weve been learning it the hard waytf.layers.conv2d38conv1 = tf.layers.conv2d(inputs=self.img, filters=32, kernel_size=5, 5, padding=SAME, activation=tf.nn.relu, name=con
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 2026秋新教材译林版五年级上册英语Unit 5 At weekends 语法讲义+练习题(含答案)
- 2026届亳州市涡阳县三下数学期末监测模拟试题含答案解析
- 什么是GEO推广?2026年企业AI搜索时代的新营销范式解读
- 银行业专业人员中级职业资格考试(银行业法律法规与综合能力)模拟试题 (2026年呼和浩特)
- 煤炭企业职工安全生产权利与义务培训
- 2026届临夏回族自治州临夏市数学四年级第二学期期中达标测试试题(含解析)
- 事业单位考试题库2026年公共基础知识必考题及答案
- 山东省曲阜市事业单位考试职业能力倾向测验(医疗卫生类E类)强化训练题库及答案
- 年湖北省环境系统事业单位人员招聘考试题库及答案解析
- 江苏省邳州市事业单位考试职业能力倾向测验(综合管理类A类)强化训练题库及答案
- 燃气管网安全培训课件
- 《诗经》诗经全文
- 初二下八升九-暑期不躺平初三一定赢-暑假前期末家长会课件
- 【曲臂式高空作业台载荷数值的估值与计算过程案例3200字】
- 2025年度食品厂安全应急演练计划
- 采购付款管理办法
- 消防防排烟系统培训课件
- 小学数学非纸笔测评任务的设计原则与实施策略
- 2025广州市小升初数学分班考试押题卷(学生版+解析版)
- 《比看上去更有意思》(2021年上海市中考满分作文33篇附审题指导)
- JG/T 335-2011混凝土结构防护用成膜型涂料
评论
0/150
提交评论