没有合适的资源?快使用搜索试试~ 我知道了~
首页Tensorflow 2.1训练 实战 cifar10 完整代码 准确率 88.6% 模型 Resnet SENet Inception
Tensorflow 2.1训练 实战 cifar10 完整代码 准确率 88.6% 模型 Resnet SENet Incep...
30 下载量 106 浏览量
更新于2023-03-03
评论 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
资源详情
资源评论
资源推荐
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):
weixin_38693586
- 粉丝: 7
- 资源: 923
上传资源 快速赚钱
- 我的内容管理 收起
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
会员权益专享
最新资源
- zigbee-cluster-library-specification
- JSBSim Reference Manual
- c++校园超市商品信息管理系统课程设计说明书(含源代码) (2).pdf
- 建筑供配电系统相关课件.pptx
- 企业管理规章制度及管理模式.doc
- vb打开摄像头.doc
- 云计算-可信计算中认证协议改进方案.pdf
- [详细完整版]单片机编程4.ppt
- c语言常用算法.pdf
- c++经典程序代码大全.pdf
- 单片机数字时钟资料.doc
- 11项目管理前沿1.0.pptx
- 基于ssm的“魅力”繁峙宣传网站的设计与实现论文.doc
- 智慧交通综合解决方案.pptx
- 建筑防潮设计-PowerPointPresentati.pptx
- SPC统计过程控制程序.pptx
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
评论0