当前位置: 首页 > news >正文

石排仿做网站厦门成品网站

石排仿做网站,厦门成品网站,枝江网站建设,怎么创建网站的快捷方式Residual net概念 概念#xff1a; Residual net(残差网络)#xff1a;将靠前若干层的某一层数据输出直接跳过多层引入到后面数据层的输入 部分。 残差神经单元#xff1a;假定某段神经网络的输入是x#xff0c;期望输出是H(x)#xff0c;如果我们直接将输入x传到输出作…Residual net概念 概念 Residual net(残差网络)将靠前若干层的某一层数据输出直接跳过多层引入到后面数据层的输入 部分。 残差神经单元假定某段神经网络的输入是x期望输出是H(x)如果我们直接将输入x传到输出作 为初始结果那么我们需要学习的目标就是F(x) H(x) - x这就是一个残差神经单元相当于将 学习目标改变了不再是学习一个完整的输出H(x)只是输出和输入的差别 H(x) - x 即残差。 细节 • 普通的直连的卷积神经网络和ResNet的最大区别在 于ResNet有很多旁路的支线将输入直接连到后面 的层使得后面的层可以直接学习残差这种结构也 被称为shortcut或skip connections。 • 传统的卷积层或全连接层在信息传递时或多或少会 存在信息丢失、损耗等问题。ResNet在某种程度上 解决了这个问题通过直接将输入信息绕道传到输出 保护信息的完整性整个网络只需要学习输入、输出 差别的那一部分简化了学习目标和难度。 思路 ResNet50有两个基本的块分别名为Conv Block和Identity Block其中Conv Block输入和输出的维度 是不一样的所以不能连续串联它的作用是改变网络的维度Identity Block输入维度和输出维度相 同可以串联用于加深网络的。 resent50代码实现 网络主体部分 #-------------------------------------------------------------# # ResNet50的网络部分 #-------------------------------------------------------------# from __future__ import print_functionimport numpy as np from keras import layersfrom keras.layers import Input from keras.layers import Dense,Conv2D,MaxPooling2D,ZeroPadding2D,AveragePooling2D from keras.layers import Activation,BatchNormalization,Flatten from keras.models import Modelfrom keras.preprocessing import image import keras.backend as K from keras.utils.data_utils import get_file from keras_applications.imagenet_utils import decode_predictions from keras_applications.imagenet_utils import preprocess_inputdef identity_block(input_tensor, kernel_size, filters, stage, block):filters1, filters2, filters3 filtersconv_name_base res str(stage) block _branchbn_name_base bn str(stage) block _branchx Conv2D(filters1, (1, 1), nameconv_name_base 2a)(input_tensor)x BatchNormalization(namebn_name_base 2a)(x)x Activation(relu)(x)x Conv2D(filters2, kernel_size,paddingsame, nameconv_name_base 2b)(x)x BatchNormalization(namebn_name_base 2b)(x)x Activation(relu)(x)x Conv2D(filters3, (1, 1), nameconv_name_base 2c)(x)x BatchNormalization(namebn_name_base 2c)(x)x layers.add([x, input_tensor])x Activation(relu)(x)return xdef conv_block(input_tensor, kernel_size, filters, stage, block, strides(2, 2)):filters1, filters2, filters3 filtersconv_name_base res str(stage) block _branchbn_name_base bn str(stage) block _branchx Conv2D(filters1, (1, 1), stridesstrides,nameconv_name_base 2a)(input_tensor)x BatchNormalization(namebn_name_base 2a)(x)x Activation(relu)(x)x Conv2D(filters2, kernel_size, paddingsame,nameconv_name_base 2b)(x)x BatchNormalization(namebn_name_base 2b)(x)x Activation(relu)(x)x Conv2D(filters3, (1, 1), nameconv_name_base 2c)(x)x BatchNormalization(namebn_name_base 2c)(x)shortcut Conv2D(filters3, (1, 1), stridesstrides,nameconv_name_base 1)(input_tensor)shortcut BatchNormalization(namebn_name_base 1)(shortcut)x layers.add([x, shortcut])x Activation(relu)(x)return xdef ResNet50(input_shape[224,224,3],classes1000):img_input Input(shapeinput_shape)x ZeroPadding2D((3, 3))(img_input)x Conv2D(64, (7, 7), strides(2, 2), nameconv1)(x)x BatchNormalization(namebn_conv1)(x)x Activation(relu)(x)x MaxPooling2D((3, 3), strides(2, 2))(x)x conv_block(x, 3, [64, 64, 256], stage2, blocka, strides(1, 1))x identity_block(x, 3, [64, 64, 256], stage2, blockb)x identity_block(x, 3, [64, 64, 256], stage2, blockc)x conv_block(x, 3, [128, 128, 512], stage3, blocka)x identity_block(x, 3, [128, 128, 512], stage3, blockb)x identity_block(x, 3, [128, 128, 512], stage3, blockc)x identity_block(x, 3, [128, 128, 512], stage3, blockd)x conv_block(x, 3, [256, 256, 1024], stage4, blocka)x identity_block(x, 3, [256, 256, 1024], stage4, blockb)x identity_block(x, 3, [256, 256, 1024], stage4, blockc)x identity_block(x, 3, [256, 256, 1024], stage4, blockd)x identity_block(x, 3, [256, 256, 1024], stage4, blocke)x identity_block(x, 3, [256, 256, 1024], stage4, blockf)x conv_block(x, 3, [512, 512, 2048], stage5, blocka)x identity_block(x, 3, [512, 512, 2048], stage5, blockb)x identity_block(x, 3, [512, 512, 2048], stage5, blockc)x AveragePooling2D((7, 7), nameavg_pool)(x)x Flatten()(x)x Dense(classes, activationsoftmax, namefc1000)(x)model Model(img_input, x, nameresnet50)model.load_weights(resnet50_weights_tf_dim_ordering_tf_kernels.h5)return modelif __name__ __main__:model ResNet50()model.summary()img_path elephant.jpg# img_path bike.jpgimg image.load_img(img_path, target_size(224, 224))x image.img_to_array(img)x np.expand_dims(x, axis0)x preprocess_input(x)print(Input image shape:, x.shape)preds model.predict(x)print(Predicted:, decode_predictions(preds))
http://wiki.neutronadmin.com/news/267377/

相关文章:

  • 深圳品牌营销型网站建设网站后台怎么修改代码
  • 能添加网站的导航有创意的网站开发
  • 中国建设银行网站-诚聘英才双流县规划建设局网站
  • p2p免费网站建设wordpress的标题字怎么变
  • 电子商务网站建设目标定制软件开发软件
  • 找兼职做网站的哪里找flask 网站开发
  • 收费图片网站网站推广工具有哪些
  • 站长百度国外域名网站
  • 各大门户网站有哪些潍坊网站制作
  • 网站开发个性化大型网站运营步骤
  • 学校网站策划书可以做语文阅读题的网站
  • 企业网站推广 知乎共享的网站备案
  • 浙江省建设会计协会网站首页中信建设有限责任公司中标公示
  • 网站设计好学吗怎么推广自己的微信号
  • 网站seo多少钱什么网站建设效果好
  • 东莞市建设工程检测中心网站小程序搭建系统
  • 网站多语言包制作图片的软件ppt
  • 素材网站设计模板ppth5怎么制作
  • 网站建设服务商有哪些如何设计网络
  • 建立大型网站wordpress大前端d84.1
  • 推网站建设话术哪些网站是做货源的
  • 淘宝客导购网站怎么建设千锋前端培训班
  • 做不了大流量网站建设公司内网网站的意义
  • 电子商务网站建设asp网址ip地址查询工具
  • 美工常用找素材网站百度网站优化升上去
  • 辽宁建设网站首页查营业执照怎么查询
  • app程序开发定制网站优化难吗
  • 网站 掌握怎么做多语言网站
  • 网站制作方案设计台州制作网站软件
  • 企业网站建设广州蓝色风格企业网站模板