资源简介
猫狗图片的识别分类,通过一个Alexnet网络模型,对猫狗图片数据集进行训练,并保存模型

代码片段和文件信息
import tensorflow as tf
def alexnet(x keep_prob num_classes):
# conv1
with tf.name_scope(‘conv1‘) as scope:
kernel = tf.Variable(tf.truncated_normal([11 11 3 96] dtype=tf.float32
stddev=1e-1) name=‘weights‘)
conv = tf.nn.conv2d(x kernel [1 4 4 1] padding=‘SAME‘)
biases = tf.Variable(tf.constant(0.0 shape=[96] dtype=tf.float32)
trainable=True name=‘biases‘)
bias = tf.nn.bias_add(conv biases)
conv1 = tf.nn.relu(bias name=scope)
# lrn1
with tf.name_scope(‘lrn1‘) as scope:
lrn1 = tf.nn.local_response_normalization(conv1
alpha=1e-4
beta=0.75
depth_radius=2
bias=2.0)
# pool1
with tf.name_scope(‘pool1‘) as scope:
pool1 = tf.nn.max_pool(lrn1
ksize=[1 3 3 1]
strides=[1 2 2 1]
padding=‘VALID‘)
# conv2
with tf.name_scope(‘conv2‘) as scope:
pool1_groups = tf.split(axis=3 value=pool1 num_or_size_splits=2)
kernel = tf.Variable(tf.truncated_normal([5 5 48 256] dtype=tf.float32
stddev=1e-1) name=‘weights‘)
kernel_groups = tf.split(axis=3 value=kernel num_or_size_splits=2)
conv_up = tf.nn.conv2d(pool1_groups[0] kernel_groups[0] [1 1 1 1] padding=‘SAME‘)
conv_down = tf.nn.conv2d(pool1_groups[1] kernel_groups[1] [1 1 1 1] padding=‘SAME‘)
biases = tf.Variable(tf.constant(0.0 shape=[256] dtype=tf.float32)
trainable=True name=‘biases‘)
biases_groups = tf.split(axis=0 value=biases num_or_size_splits=2)
bias_up = tf.nn.bias_add(conv_up biases_groups[0])
bias_down = tf.nn.bias_add(conv_down biases_groups[1])
bias = tf.concat(axis=3 values=[bias_up bias_down])
conv2 = tf.nn.relu(bias name=scope)
# lrn2
with tf.name_scope(‘lrn2‘) as scope:
lrn2 = tf.nn.local_response_normalization(conv2
alpha=1e-4
beta=0.75
depth_radius=2
bias=2.0)
# pool2
with tf.name_scope(‘pool2‘) as scope:
pool2 = tf.nn.max_pool(lrn2
ksize=[1 3 3 1]
strides=[1 2 2 1]
padding=‘VALID‘)
# conv3
with tf.name_scope(‘conv3‘) as scope:
kernel = tf.Variable(tf.truncated_normal([3 3 256 384]
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2019-04-14 20:42 cats and dogs\
目录 0 2019-04-14 20:42 cats and dogs\.idea\
目录 0 2019-04-12 20:13 cats and dogs\.idea\inspectionProfiles\
文件 243 2019-04-12 20:12 cats and dogs\.idea\misc.xm
文件 276 2019-04-12 20:12 cats and dogs\.idea\modules.xm
文件 16613 2019-04-13 21:03 cats and dogs\.idea\workspace.xm
文件 459 2019-04-12 20:13 cats and dogs\.idea\猫狗大战.iml
目录 0 2019-04-14 20:42 cats and dogs\__pycache__\
文件 4107 2019-04-12 20:30 cats and dogs\__pycache__\alexnet.cpython-35.pyc
文件 2213 2019-04-12 21:30 cats and dogs\__pycache__\datagenerator.cpython-35.pyc
文件 7712 2019-04-12 20:15 cats and dogs\alexnet.py
文件 2190 2019-04-12 21:16 cats and dogs\datagenerator.py
文件 8543 2019-04-12 22:21 cats and dogs\main_alexnet.py
文件 1151 2019-04-12 21:03 cats and dogs\rename_file.py
- 上一篇:基于atmega16单片机的时钟
- 下一篇:spring5.0的全部xsd文件
相关资源
- ppt 机器学习.ppt
- Logistic回归总结非常好的机器学习总结
- 广联达6.0写锁包,2020年11月最新
- Convex Analysis and Optimization (Bertsekas
- 机器学习个人笔记完整版v5.2-A4打印版
- 深度学习卷积神经网络可检测和分类
- JUNIOR:粒子物理学中无监督机器学习
- 语料库.zip
- GAN对抗式生成网络的应用:从图片上
- [en]深度学习[Deep Learning: Adaptive Compu
- 中国科学技术大学 研究生课程 机器学
- 遗传算法越野小车unity5.5
- 吴恩达机器学习编程题
- shape_predictor_68_face_landmarks.dat.bz2 68个标
- 机器学习实战高清pdf,中文版+英文版
- 李宏毅-机器学习(视频2017完整)
- 吴恩达深度学习第一课第四周作业及
- 机器学习深度学习 PPT
- 麻省理工:深度学习介绍PPT-1
- Wikipedia机器学习迷你电子书之四《D
- 深度学习在遥感中的应用综述
- Learning From Data Yaser S. Abu-Mostafa
- 深度学习数据集标注
- 深度学习算法实践源码-吴岸城
- 北大林宙辰:机器学习一阶算法的优
- 李宏毅深度学习ppt
- 机器学习方法R实现-用决策树、神经网
- 数字金融反欺诈白皮书
- SSD目标检测算法论文-英文原版
- 台湾李宏毅教授深度学习讲义 pdf
评论
共有 条评论