没有合适的资源?快使用搜索试试~ 我知道了~
首页Tensorflow 2.1训练 实战 cifar10 完整代码 准确率 88.6% 模型 Resnet SENet Inception
Tensorflow 2.1训练 实战 cifar10 完整代码 准确率 88.6% 模型 Resnet SENet Incep...
25 下载量 91 浏览量
更新于2023-03-16
5
收藏 55KB PDF 举报
环境: tensorflow 2.1 最好用GPU 模型: Resnet:把前一层的数据直接加到下一层里。减少数据在传播过程中过多的丢失。 SENet: 学习每一层的通道之间的关系 Inception: 每一层都用不同的核(1×1,3×3,5×5)来学习.防止因为过小的核或者过大的核而学不到图片的特征。 用Resnet ,SENet, Inceptiont网络训练Cifar10 或者Cifar 100. 训练数据:Cifar10 或者 Cifar 100 训练集上准确率:97.11%左右 验证集上准确率:90.22%左右 测试集上准确率:88.6% 训练时间在GPU上:一小时多 权重大小:21
资源详情
资源推荐
![](https://csdnimg.cn/release/download_crawler_static/13749920/bg1.jpg)
Tensorflow 2.1训练训练 实战实战 cifar10 完整代码完整代码 准确率准确率 88.6% 模模
型型 Resnet SENet Inception
环境环境:
tensorflow 2.1
最好用GPU
模型模型:
Resnet:把前一层的数据直接加到下一层里。减少数据在传播过程中过多的丢失。
SENet: 学习每一层的通道之间的关系
Inception: 每一层都用不同的核(1×1,3×3,5×5)来学习.防止因为过小的核或者过大的核而学不到图片的特征。
用Resnet ,SENet, Inceptiont网络训练Cifar10 或者Cifar 100.
训练数据:Cifar10 或者 Cifar 100
训练集上准确率:97.11%左右
验证集上准确率:90.22%左右
测试集上准确率:88.6%
训练时间在GPU上:一小时多
权重大小:21.8 MB
训练的历程: 普通网络(65%左右)-> 数据增强(70%左右)->模型增强(进入Resnet 和SEnet) 80%左右 -> 模型的结构做了调整模型的结构做了调整
((86% ))- > 加加inception 模型后(模型后(88.6%))
训练集与验证集上的测试结果:
347/351 [============================>.] - ETA: 0s - loss: 0.0827 - sparse_categorical_accuracy: 0.9711
348/351 [============================>.] - ETA: 0s - loss: 0.0828 - sparse_categorical_accuracy: 0.9710
349/351 [============================>.] - ETA: 0s - loss: 0.0827 - sparse_categorical_accuracy: 0.9710
350/351 [============================>.] - ETA: 0s - loss: 0.0826 - sparse_categorical_accuracy: 0.9711
351/351 [==============================] - 20s 57ms/step - loss: 0.0826 - sparse_categorical_accuracy: 0.9711 - val_loss: 0.3952 -
val_sparse_categorical_accuracy: 0.9022
测试集上的结果
79/79 - 4s - loss: 0.4005 - sparse_categorical_accuracy: 0.8842
[0.40052215495630156, 0.8842] time 4.130274534225464
下面是完整的代码,运行前建一下这个目录weights4_5,不想写代码自动化建了。
如果要训练Cifar100,直接把cifar10 改成cifar100就可以了。不需要改其它地方
import tensorflow as tf
import tensorflow.keras as keras
import tensorflow.keras.layers as layers
import image_augument.image_augment as image_augment
import time as time
import tensorflow.keras.preprocessing.image as image
import matplotlib.pyplot as plt
import os
def senet_block(inputs, ratio):
shape = inputs.shape
channel_out = shape[-1] # print(shape)
# (2, 28, 28, 32) , [1,28,28,1], [1,28,28,1] squeeze = layers.GlobalAveragePooling2D()(inputs)
# [2, 1, 1, 32] # print(squeeze.shape)
# 第二层,全连接层
# [2,32] # print(squeeze.shape)
shape_result = layers.Flatten()(squeeze)
# print(shape_result.shape)
# [32,2] shape_result = layers.Dense(int(channel_out / ratio), activation='relu')(shape_result)
# shape_result = layers.BatchNormalization()(shape_result)
# [2,32] shape_result = layers.Dense(channel_out, activation='sigmoid')(shape_result)
# shape_result = layers.BatchNormalization()(shape_result)
# 第四层,点乘
# print('heres2')
excitation_output = tf.reshape(shape_result, [-1, 1, 1, channel_out])
# print(excitation_output.shape)
h_output = excitation_output * inputs
return h_output
def inception_block(input, input_filter, output_filter):
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://profile-avatar.csdnimg.cn/default.jpg!1)
weixin_38674883
- 粉丝: 3
- 资源: 943
上传资源 快速赚钱
我的内容管理 收起
我的资源 快来上传第一个资源
我的收益
登录查看自己的收益我的积分 登录查看自己的积分
我的C币 登录后查看C币余额
我的收藏
我的下载
下载帮助
![](https://csdnimg.cn/release/wenkucmsfe/public/img/voice.245cc511.png)
会员权益专享
最新资源
- 基于嵌入式ARMLinux的播放器的设计与实现 word格式.doc
- 经典:大学答辩通过_基于ARM微处理器的嵌入式指纹识别系统设计.pdf
- 嵌入式系统课程设计.doc
- 基于飞思卡尔控制器的智能寻迹车设计ARM基础课程课程设计.doc
- 下载基于ARM7的压电陶瓷换能器导纳圆测量仪的研制PDF格式可编辑.pdf
- 课程设计基于ARM的嵌入式家居监控系统的研究与设计.doc
- 论文基于嵌入式ARM的图像采集处理系统设计.doc
- 嵌入式基于ARM9的中断驱动程序设计—课程设计.doc
- 在Linux系统下基于ARM嵌入式的俄罗斯方块.doc
- STK-MirrorStore Product Release Notes(96130)-44
- STK-MirrorStore Storage Connectivity Guide for StorageTek Disk A
- 龙虾养殖远程监控系统的设计与实现数据采集上位-机软件模块-本科毕业设计.doc
- 龙虾养殖远程监控系统的设计与实现数据采集上位-机软件模块-.doc
- 龙虾养殖远程监控系统的设计与实现数据采集上位-机软件模块-本科生毕业论文.doc
- 麻阳风貌展示网站的设计与实现毕业论文.pdf
- 高速走丝气中电火花线切割精加工编程设计.doc
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
![](https://img-home.csdnimg.cn/images/20220527035711.png)
![](https://img-home.csdnimg.cn/images/20220527035711.png)
![](https://img-home.csdnimg.cn/images/20220527035111.png)
安全验证
文档复制为VIP权益,开通VIP直接复制
![](https://csdnimg.cn/release/wenkucmsfe/public/img/green-success.6a4acb44.png)