




版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
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. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 妇科病例分析:从痛经到急腹症的诊断与治疗
- 呼吸科气管切开疑难病例讨论
- 髋关节骨折的护理常规
- 初中生命与健康知识精讲
- 学前教育核心体系解析
- 预防艾滋病安全教育课件
- 死亡病例讨论制度专题培训
- 顺德英语说课课件
- 项链说课课件
- 城镇污水管网建设工程风险管理方案
- HG-T20678-2023《化工设备衬里钢壳设计标准》
- 初中数学分层作业设计论文
- 中小学校长管理案例
- 《电力设施治安安全风险等级和安全防护要求》
- 工程项目部安全生产治本攻坚三年行动实施方案
- 四川建筑安全员-C证考试(专职安全员)题库及答案
- 光伏验收报告
- 职业倦怠量表MBI-HSS
- 学校桌椅采购投标方案
- 盘扣式外脚手架施工方案
- 初中数学目录(浙教版)
评论
0/150
提交评论