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

如何查网站域名备案重庆梁平网站建设报价

如何查网站域名备案,重庆梁平网站建设报价,备案的时候网站要建设好吗,8个实用的wordpress数据库技巧文章目录 一、前言二、前期工作1. 设置GPU#xff08;如果使用的是CPU可以忽略这步#xff09;2. 导入数据3. 查看数据 二、数据预处理1. 加载数据2. 可视化数据3. 再次检查数据4. 配置数据集 三、构建Inception V3网络模型1.自己搭建2.官方模型 五、编译六、训练模型七、模型… 文章目录 一、前言二、前期工作1. 设置GPU如果使用的是CPU可以忽略这步2. 导入数据3. 查看数据 二、数据预处理1. 加载数据2. 可视化数据3. 再次检查数据4. 配置数据集 三、构建Inception V3网络模型1.自己搭建2.官方模型 五、编译六、训练模型七、模型评估二、构建一个tf.data.Dataset1.预处理函数 七、保存和加载模型八、预测 一、前言 我的环境 语言环境Python3.6.5编译器jupyter notebook深度学习环境TensorFlow2.4.1 往期精彩内容 卷积神经网络CNN实现mnist手写数字识别 卷积神经网络CNN多种图片分类的实现卷积神经网络CNN衣服图像分类的实现卷积神经网络CNN鲜花识别卷积神经网络CNN天气识别 卷积神经网络VGG-16识别海贼王草帽一伙卷积神经网络ResNet-50鸟类识别 卷积神经网络AlexNet鸟类识别卷积神经网络(CNN)识别验证码 来自专栏机器学习与深度学习算法推荐 二、前期工作 1. 设置GPU如果使用的是CPU可以忽略这步 import tensorflow as tfgpus tf.config.list_physical_devices(GPU)if gpus:tf.config.experimental.set_memory_growth(gpus[0], True) #设置GPU显存用量按需使用tf.config.set_visible_devices([gpus[0]],GPU)2. 导入数据 import matplotlib.pyplot as plt # 支持中文 plt.rcParams[font.sans-serif] [SimHei] # 用来正常显示中文标签 plt.rcParams[axes.unicode_minus] False # 用来正常显示负号import os,PIL,pathlib# 设置随机种子尽可能使结果可以重现 import numpy as np np.random.seed(1)# 设置随机种子尽可能使结果可以重现 import tensorflow as tf tf.random.set_seed(1)from tensorflow import keras from tensorflow.keras import layers,modelsdata_dir code data_dir pathlib.Path(data_dir)all_image_paths list(data_dir.glob(*)) all_image_paths [str(path) for path in all_image_paths]# 打乱数据 random.shuffle(all_image_paths)# 获取数据标签 all_label_names [path.split(\\)[5].split(.)[0] for path in all_image_paths]image_count len(all_image_paths) print(图片总数为,image_count)data_dir gesturesdata_dir pathlib.Path(data_dir)3. 查看数据 image_count len(list(data_dir.glob(*/*)))print(图片总数为,image_count)图片总数为 12547二、数据预处理 本文主要是识别24个英文字母的手语姿势另外两个字母的手语是动作其中每一个手语姿势图片均有500张。 1. 加载数据 使用image_dataset_from_directory方法将磁盘中的数据加载到tf.data.Dataset中 batch_size 8 img_height 224 img_width 224TensorFlow版本是2.2.0的同学可能会遇到module tensorflow.keras.preprocessing has no attribute image_dataset_from_directory的报错升级一下TensorFlow就OK了。 train_ds tf.keras.preprocessing.image_dataset_from_directory(data_dir,validation_split0.2,subsettraining,seed123,image_size(img_height, img_width),batch_sizebatch_size)Found 12547 files belonging to 24 classes. Using 10038 files for training.val_ds tf.keras.preprocessing.image_dataset_from_directory(data_dir,validation_split0.2,subsetvalidation,seed123,image_size(img_height, img_width),batch_sizebatch_size)class_names train_ds.class_names print(class_names)[a, b, c, d, e, f, g, h, i, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y]2. 可视化数据 plt.figure(figsize(10, 5)) # 图形的宽为10高为5for images, labels in train_ds.take(1):for i in range(8):ax plt.subplot(2, 4, i 1) plt.imshow(images[i].numpy().astype(uint8))plt.title(class_names[labels[i]])plt.axis(off)plt.imshow(images[1].numpy().astype(uint8))3. 再次检查数据 for image_batch, labels_batch in train_ds:print(image_batch.shape)print(labels_batch.shape)break(8, 224, 224, 3) (8,)Image_batch是形状的张量8, 224, 224, 3)。这是一批形状240x240x3的8张图片最后一维指的是彩色通道RGB。Label_batch是形状8的张量这些标签对应8张图片 4. 配置数据集 AUTOTUNE tf.data.AUTOTUNEtrain_ds train_ds.cache().shuffle(1000).prefetch(buffer_sizeAUTOTUNE) val_ds val_ds.cache().prefetch(buffer_sizeAUTOTUNE)三、构建Inception V3网络模型 1.自己搭建 下面是本文的重点 Inception V3 网络模型的构建可以试着按照上面的图自己构建一下 Inception V3这部分我主要是参考官网的构建过程将其单独拎了出来。 # # Inception V3 网络 #from tensorflow.keras.models import Model from tensorflow.keras import layers from tensorflow.keras.layers import Activation,Dense,Input,BatchNormalization,Conv2D,AveragePooling2D from tensorflow.keras.layers import GlobalAveragePooling2D,MaxPooling2Ddef conv2d_bn(x,filters,num_row,num_col,paddingsame,strides(1, 1),nameNone):if name is not None:bn_name name _bnconv_name name _convelse:bn_name Noneconv_name Nonex Conv2D(filters,(num_row, num_col),stridesstrides,paddingpadding,use_biasFalse,nameconv_name)(x)x BatchNormalization(scaleFalse, namebn_name)(x)x Activation(relu, namename)(x)return xdef InceptionV3(input_shape[224,224,3],classes1000):img_input Input(shapeinput_shape)x conv2d_bn(img_input, 32, 3, 3, strides(2, 2), paddingvalid)x conv2d_bn(x, 32, 3, 3, paddingvalid)x conv2d_bn(x, 64, 3, 3)x MaxPooling2D((3, 3), strides(2, 2))(x)x conv2d_bn(x, 80, 1, 1, paddingvalid)x conv2d_bn(x, 192, 3, 3, paddingvalid)x MaxPooling2D((3, 3), strides(2, 2))(x)### Block1 35x35### Block1 part1# 35 x 35 x 192 - 35 x 35 x 256branch1x1 conv2d_bn(x, 64, 1, 1)branch5x5 conv2d_bn(x, 48, 1, 1)branch5x5 conv2d_bn(branch5x5, 64, 5, 5)branch3x3dbl conv2d_bn(x, 64, 1, 1)branch3x3dbl conv2d_bn(branch3x3dbl, 96, 3, 3)branch3x3dbl conv2d_bn(branch3x3dbl, 96, 3, 3)branch_pool AveragePooling2D((3, 3), strides(1, 1), paddingsame)(x)branch_pool conv2d_bn(branch_pool, 32, 1, 1)x layers.concatenate([branch1x1, branch5x5, branch3x3dbl, branch_pool],axis3,namemixed0)# Block1 part2# 35 x 35 x 256 - 35 x 35 x 288branch1x1 conv2d_bn(x, 64, 1, 1)branch5x5 conv2d_bn(x, 48, 1, 1)branch5x5 conv2d_bn(branch5x5, 64, 5, 5)branch3x3dbl conv2d_bn(x, 64, 1, 1)branch3x3dbl conv2d_bn(branch3x3dbl, 96, 3, 3)branch3x3dbl conv2d_bn(branch3x3dbl, 96, 3, 3)branch_pool AveragePooling2D((3, 3), strides(1, 1), paddingsame)(x)branch_pool conv2d_bn(branch_pool, 64, 1, 1)x layers.concatenate([branch1x1, branch5x5, branch3x3dbl, branch_pool],axis3,namemixed1)# Block1 part3# 35 x 35 x 288 - 35 x 35 x 288branch1x1 conv2d_bn(x, 64, 1, 1)branch5x5 conv2d_bn(x, 48, 1, 1)branch5x5 conv2d_bn(branch5x5, 64, 5, 5)branch3x3dbl conv2d_bn(x, 64, 1, 1)branch3x3dbl conv2d_bn(branch3x3dbl, 96, 3, 3)branch3x3dbl conv2d_bn(branch3x3dbl, 96, 3, 3)branch_pool AveragePooling2D((3, 3), strides(1, 1), paddingsame)(x)branch_pool conv2d_bn(branch_pool, 64, 1, 1)x layers.concatenate([branch1x1, branch5x5, branch3x3dbl, branch_pool],axis3,namemixed2)### Block2 17x17### Block2 part1# 35 x 35 x 288 - 17 x 17 x 768branch3x3 conv2d_bn(x, 384, 3, 3, strides(2, 2), paddingvalid)branch3x3dbl conv2d_bn(x, 64, 1, 1)branch3x3dbl conv2d_bn(branch3x3dbl, 96, 3, 3)branch3x3dbl conv2d_bn(branch3x3dbl, 96, 3, 3, strides(2, 2), paddingvalid)branch_pool MaxPooling2D((3, 3), strides(2, 2))(x)x layers.concatenate([branch3x3, branch3x3dbl, branch_pool], axis3, namemixed3)# Block2 part2# 17 x 17 x 768 - 17 x 17 x 768branch1x1 conv2d_bn(x, 192, 1, 1)branch7x7 conv2d_bn(x, 128, 1, 1)branch7x7 conv2d_bn(branch7x7, 128, 1, 7)branch7x7 conv2d_bn(branch7x7, 192, 7, 1)branch7x7dbl conv2d_bn(x, 128, 1, 1)branch7x7dbl conv2d_bn(branch7x7dbl, 128, 7, 1)branch7x7dbl conv2d_bn(branch7x7dbl, 128, 1, 7)branch7x7dbl conv2d_bn(branch7x7dbl, 128, 7, 1)branch7x7dbl conv2d_bn(branch7x7dbl, 192, 1, 7)branch_pool AveragePooling2D((3, 3), strides(1, 1), paddingsame)(x)branch_pool conv2d_bn(branch_pool, 192, 1, 1)x layers.concatenate([branch1x1, branch7x7, branch7x7dbl, branch_pool],axis3,namemixed4)# Block2 part3 and part4# 17 x 17 x 768 - 17 x 17 x 768 - 17 x 17 x 768for i in range(2):branch1x1 conv2d_bn(x, 192, 1, 1)branch7x7 conv2d_bn(x, 160, 1, 1)branch7x7 conv2d_bn(branch7x7, 160, 1, 7)branch7x7 conv2d_bn(branch7x7, 192, 7, 1)branch7x7dbl conv2d_bn(x, 160, 1, 1)branch7x7dbl conv2d_bn(branch7x7dbl, 160, 7, 1)branch7x7dbl conv2d_bn(branch7x7dbl, 160, 1, 7)branch7x7dbl conv2d_bn(branch7x7dbl, 160, 7, 1)branch7x7dbl conv2d_bn(branch7x7dbl, 192, 1, 7)branch_pool AveragePooling2D((3, 3), strides(1, 1), paddingsame)(x)branch_pool conv2d_bn(branch_pool, 192, 1, 1)x layers.concatenate([branch1x1, branch7x7, branch7x7dbl, branch_pool],axis3,namemixed str(5 i))# Block2 part5# 17 x 17 x 768 - 17 x 17 x 768branch1x1 conv2d_bn(x, 192, 1, 1)branch7x7 conv2d_bn(x, 192, 1, 1)branch7x7 conv2d_bn(branch7x7, 192, 1, 7)branch7x7 conv2d_bn(branch7x7, 192, 7, 1)branch7x7dbl conv2d_bn(x, 192, 1, 1)branch7x7dbl conv2d_bn(branch7x7dbl, 192, 7, 1)branch7x7dbl conv2d_bn(branch7x7dbl, 192, 1, 7)branch7x7dbl conv2d_bn(branch7x7dbl, 192, 7, 1)branch7x7dbl conv2d_bn(branch7x7dbl, 192, 1, 7)branch_pool AveragePooling2D((3, 3), strides(1, 1), paddingsame)(x)branch_pool conv2d_bn(branch_pool, 192, 1, 1)x layers.concatenate([branch1x1, branch7x7, branch7x7dbl, branch_pool],axis3,namemixed7)### Block3 8x8### Block3 part1# 17 x 17 x 768 - 8 x 8 x 1280branch3x3 conv2d_bn(x, 192, 1, 1)branch3x3 conv2d_bn(branch3x3, 320, 3, 3,strides(2, 2), paddingvalid)branch7x7x3 conv2d_bn(x, 192, 1, 1)branch7x7x3 conv2d_bn(branch7x7x3, 192, 1, 7)branch7x7x3 conv2d_bn(branch7x7x3, 192, 7, 1)branch7x7x3 conv2d_bn(branch7x7x3, 192, 3, 3, strides(2, 2), paddingvalid)branch_pool MaxPooling2D((3, 3), strides(2, 2))(x)x layers.concatenate([branch3x3, branch7x7x3, branch_pool], axis3, namemixed8)# Block3 part2 part3# 8 x 8 x 1280 - 8 x 8 x 2048 - 8 x 8 x 2048for i in range(2):branch1x1 conv2d_bn(x, 320, 1, 1)branch3x3 conv2d_bn(x, 384, 1, 1)branch3x3_1 conv2d_bn(branch3x3, 384, 1, 3)branch3x3_2 conv2d_bn(branch3x3, 384, 3, 1)branch3x3 layers.concatenate([branch3x3_1, branch3x3_2], axis3, namemixed9_ str(i))branch3x3dbl conv2d_bn(x, 448, 1, 1)branch3x3dbl conv2d_bn(branch3x3dbl, 384, 3, 3)branch3x3dbl_1 conv2d_bn(branch3x3dbl, 384, 1, 3)branch3x3dbl_2 conv2d_bn(branch3x3dbl, 384, 3, 1)branch3x3dbl layers.concatenate([branch3x3dbl_1, branch3x3dbl_2], axis3)branch_pool AveragePooling2D((3, 3), strides(1, 1), paddingsame)(x)branch_pool conv2d_bn(branch_pool, 192, 1, 1)x layers.concatenate([branch1x1, branch3x3, branch3x3dbl, branch_pool],axis3,namemixed str(9 i))# 平均池化后全连接。x GlobalAveragePooling2D(nameavg_pool)(x)x Dense(classes, activationsoftmax, namepredictions)(x)inputs img_inputmodel Model(inputs, x, nameinception_v3)return modelmodel InceptionV3() model.summary()2.官方模型 # import tensorflow as tf# model_2 tf.keras.applications.InceptionV3() # model_2.summary()五、编译 在准备对模型进行训练之前还需要再对其进行一些设置。以下内容是在模型的编译步骤中添加的 损失函数loss用于衡量模型在训练期间的准确率。优化器optimizer决定模型如何根据其看到的数据和自身的损失函数进行更新。指标metrics用于监控训练和测试步骤。以下示例使用了准确率即被正确分类的图像的比率。 # 设置优化器我这里改变了学习率。 opt tf.keras.optimizers.Adam(learning_rate1e-5)model.compile(optimizeropt,losssparse_categorical_crossentropy,metrics[accuracy])六、训练模型 epochs 10history model.fit(train_ds,validation_dataval_ds,epochsepochs )Epoch 1/10 1255/1255 [] - 146s 77ms/step - loss: 3.9494 - accuracy: 0.3102 - val_loss: 0.6095 - val_accuracy: 0.8481 Epoch 2/10 1255/1255 [] - 70s 56ms/step - loss: 0.7071 - accuracy: 0.8370 - val_loss: 0.1968 - val_accuracy: 0.9430 Epoch 3/10 1255/1255 [] - 70s 56ms/step - loss: 0.2956 - accuracy: 0.9380 - val_loss: 0.0834 - val_accuracy: 0.9757 Epoch 4/10 1255/1255 [] - 70s 56ms/step - loss: 0.1344 - accuracy: 0.9766 - val_loss: 0.0452 - val_accuracy: 0.9884 Epoch 5/10 1255/1255 [] - 71s 57ms/step - loss: 0.0566 - accuracy: 0.9954 - val_loss: 0.0265 - val_accuracy: 0.9916 Epoch 6/10 1255/1255 [] - 72s 57ms/step - loss: 0.0282 - accuracy: 0.9988 - val_loss: 0.0158 - val_accuracy: 0.9956 Epoch 7/10 1255/1255 [] - 72s 57ms/step - loss: 0.0150 - accuracy: 0.9994 - val_loss: 0.0218 - val_accuracy: 0.9924 Epoch 8/10 1255/1255 [] - 72s 57ms/step - loss: 0.0188 - accuracy: 0.9979 - val_loss: 0.0125 - val_accuracy: 0.9968 Epoch 9/10 1255/1255 [] - 71s 57ms/step - loss: 0.0122 - accuracy: 0.9986 - val_loss: 0.0542 - val_accuracy: 0.9833 Epoch 10/10 1255/1255 [] - 70s 56ms/step - loss: 0.0178 - accuracy: 0.9964 - val_loss: 0.0213 - val_accuracy: 0.9924七、模型评估 acc history.history[accuracy] val_acc history.history[val_accuracy]loss history.history[loss] val_loss history.history[val_loss]epochs_range range(epochs)plt.figure(figsize(12, 4)) plt.subplot(1, 2, 1) plt.suptitle(微信公众号(K同学啊)中回复DL13可获取数据)plt.plot(epochs_range, acc, labelTraining Accuracy) plt.plot(epochs_range, val_acc, labelValidation Accuracy) plt.legend(loclower right) plt.title(Training and Validation Accuracy)plt.subplot(1, 2, 2) plt.plot(epochs_range, loss, labelTraining Loss) plt.plot(epochs_range, val_loss, labelValidation Loss) plt.legend(locupper right) plt.title(Training and Validation Loss) plt.show()二、构建一个tf.data.Dataset 1.预处理函数 acc history.history[accuracy] val_acc history.history[val_accuracy]loss history.history[loss] val_loss history.history[val_loss]epochs_range range(epochs)plt.figure(figsize(12, 4)) plt.subplot(1, 2, 1)plt.plot(epochs_range, acc, labelTraining Accuracy) plt.plot(epochs_range, val_acc, labelValidation Accuracy) plt.legend(loclower right) plt.title(Training and Validation Accuracy)plt.subplot(1, 2, 2) plt.plot(epochs_range, loss, labelTraining Loss) plt.plot(epochs_range, val_loss, labelValidation Loss) plt.legend(locupper right) plt.title(Training and Validation Loss) plt.show()七、保存和加载模型 # 保存模型 model.save(model/12_model.h5)# 加载模型 new_model tf.keras.models.load_model(model/12_model.h5)八、预测 # 采用加载的模型new_model来看预测结果plt.figure(figsize(10, 5)) # 图形的宽为10高为5for images, labels in val_ds.take(1):for i in range(8):ax plt.subplot(2, 4, i 1) # 显示图片plt.imshow(images[i].numpy().astype(uint8))# 需要给图片增加一个维度img_array tf.expand_dims(images[i], 0) # 使用模型预测图片中的人物predictions new_model.predict(img_array)plt.title(class_names[np.argmax(predictions)])plt.axis(off)
http://wiki.neutronadmin.com/news/84972/

相关文章:

  • 网站建设证有中国建设网查询平台网址
  • 网站的维护和推广广告在线设计制作
  • 建站套餐推荐怎么优化百度关键词
  • 网站关站域名解析错误连不上网
  • 网上有做logo的网站吗个人网站备案简介
  • 网站建设个人年终总结机械模板网站
  • 搭建一个网站的流程建设银行咸阳交费网站
  • 建什么网站可以赚钱怎么在网站添加关键词
  • 网站制作流程一般制作流程?巨量千川广告投放平台
  • 深圳网站建设有限公司宏润建设集团股份有限公司网站
  • 用php做的博客网站有哪些高州新闻 头条 今天
  • 网站建设运营维护方案搜索引擎推广特点
  • 做网站开源深圳市招投标交易中心
  • 公司网站的个人主页怎么做网络游戏传奇
  • 做网站要多少费用环保局网站如何做备案证明
  • 黄山建设网站公司电话号码wordpress 常用钩子
  • 杭州住房和城乡建设局网站首页企业软件管家
  • 网站模板安装好后腾讯街景地图全景在线
  • 哪些网站怎么进桓台做网站
  • 建造个网站花多少钱广西建设工会网站
  • 凡客网站做SEO能被收录吗横琴高新区最新
  • 机票酒店 网站建设阿里指数查询手机版
  • 建筑网建设通查询东莞市seo网络推广价格
  • 怎末把域名装wordpress上海网络优化seo
  • 网站建设是不是要有营业执照长沙网络销售公司
  • 建设银行网站为什么打不开网站空间升级通知
  • 五金加工东莞网站建设考试网站怎么做的
  • 在网站中加入锚链接应该怎么做seo是指什么岗位
  • 广安网站制作设计黑龙江牡丹江双鸭山伊春推广
  • 受欢迎的郑州网站建设wordpress 修改轮播