Deep Learning-TensorFlow (10) CNN卷积神经网络_ TFLearn 快速搭建深度学习模型

本文介绍了如何利用TFLearn这个基于TensorFlow的高层API来快速搭建卷积神经网络(CNN)。通过TFLearn,可以简化深度学习模型的构建过程,包括AlexNet的实现,并提供了在Oxford 17类鲜花数据集上的应用示例。TFLearn具有模块化设计,支持多种深度学习模型,如CNN、LSTM等,并且支持多GPU训练。
摘要由CSDN通过智能技术生成

环境:Win8.1 TensorFlow1.0.1

软件:Anaconda3 (集成Python3及开发环境)

TensorFlow安装:pip install tensorflow (CPU版) pip install tensorflow-gpu (GPU版)

TFLearn安装:pip install tflearn


参考:

1. TFLearn: Deep learning library featuring a higher-level API for TensorFlow

2. Github: tflearn


1. 前言

在之间的博文中,我们介绍了深度学习的组成和发展,推动卷积神经网络快速发展的经典模型(AlexNet、VGG、Google Inception Net、ResNet),以及我们如何利用 TensorFlow 建立一个自己的简单 CNN 网络完成特定任务,例如 2层卷积层+2层全连接层+Softmax_CrossEntropy 完成 CIFAR-10 图像分类。随着计算资源平台的飞速发展,我们可以训练更深的网络解决更复杂问题和提高准确率,如 ResNet 使用 Residual Unit 成功训练152层深的神经网络,在 ILSVRC 2015 比赛中获得了冠军,取得3.57%的 top-5 错误率,同时参数量却比 VGGNet 低,效果非常突出。


当我们使用 TensorFlow 建立网络的一层 conv+pooling+lrn 时,可以采用最基本的定义:

# conv1
  with tf.variable_scope('conv1') as scope:
    kernel = _variable_with_weight_decay('weights', shape=[5, 5, 3, 64],
                                         stddev=1e-4, wd=0.0)
    conv = tf.nn.conv2d(images, kernel, [1, 1, 1, 1], padding='SAME')
    biases = _variable_on_cpu('biases', [64], tf.constant_initializer(0.0))
    bias = tf.nn.bias_add(conv, biases)
    conv1 = tf.nn.relu(bias, name=scope.name)
    _activation_summary(conv1)

  # pool1
  pool1 = tf.nn.max_pool(conv1, ksize=[1, 3, 3, 1], strides=[1, 2, 2, 1],
                         padding='SAME', name='pool1')
  # norm1
  norm1 = tf.nn.lrn(pool1, 4, bias=
  • 3
    点赞
  • 16
    收藏
    觉得还不错? 一键收藏
  • 10
    评论
评论 10
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值