他会自己下载数据:

# -*- coding: utf-8 -*-

""" AlexNet.
Applying 'Alexnet' to Oxford's 17 Category Flower Dataset classification task.
References:
- Alex Krizhevsky, Ilya Sutskever & Geoffrey E. Hinton. ImageNet
Classification with Deep Convolutional Neural Networks. NIPS, 2012.
- 17 Category Flower Dataset. Maria-Elena Nilsback and Andrew Zisserman.
Links:
- [AlexNet Paper](http://papers.nips.cc/paper/4824-imagenet-classification-with-deep-convolutional-neural-networks.pdf)
- [Flower Dataset (17)](http://www.robots.ox.ac.uk/~vgg/data/flowers/17/)
""" from __future__ import division, print_function, absolute_import import tflearn
from tflearn.layers.core import input_data, dropout, fully_connected
from tflearn.layers.conv import conv_2d, max_pool_2d
from tflearn.layers.normalization import local_response_normalization
from tflearn.layers.estimator import regression import tflearn.datasets.oxflower17 as oxflower17
X, Y = oxflower17.load_data(one_hot=True, resize_pics=(227, 227)) # Building 'AlexNet'
network = input_data(shape=[None, 227, 227, 3])
network = conv_2d(network, 96, 11, strides=4, activation='relu')
network = max_pool_2d(network, 3, strides=2)
network = local_response_normalization(network)
network = conv_2d(network, 256, 5, activation='relu')
network = max_pool_2d(network, 3, strides=2)
network = local_response_normalization(network)
network = conv_2d(network, 384, 3, activation='relu')
network = conv_2d(network, 384, 3, activation='relu')
network = conv_2d(network, 256, 3, activation='relu')
network = max_pool_2d(network, 3, strides=2)
network = local_response_normalization(network)
network = fully_connected(network, 4096, activation='tanh')
network = dropout(network, 0.5)
network = fully_connected(network, 4096, activation='tanh')
network = dropout(network, 0.5)
network = fully_connected(network, 17, activation='softmax')
network = regression(network, optimizer='momentum',
loss='categorical_crossentropy',
learning_rate=0.001) # Training
model = tflearn.DNN(network, checkpoint_path='model_alexnet',
max_checkpoints=1, tensorboard_verbose=2)
#model.fit(X, Y, n_epoch=1000, validation_set=0.1, shuffle=True,
model.fit(X, Y, n_epoch=10, validation_set=0.1, shuffle=True,
show_metric=True, batch_size=64, snapshot_step=200,
snapshot_epoch=False, run_id='alexnet_oxflowers17')
model.save('flower-classifier')

打开tensotboard: tensorboard --logdir=/tmp/tflearn_logs/

通过tensorboard查看准确率变化以及loss变化,上图是跑了10个epoch的结果。

tflearn alexnet iter 10的更多相关文章

  1. 神经网络的结构汇总——tflearn

    一些先进的网络结构: # https://github.com/tflearn/tflearn/blob/master/examples/images/highway_dnn.py # -*- cod ...

  2. TFLearn构建神经网络

    TFLearn构建神经网络 Building the network TFLearn lets you build the network by defining the layers. Input ...

  3. TFLearn 与 Tensorflow 一起使用

    好用的不是一点点..=-=.. import tensorflow as tf import tflearn import tflearn.datasets.mnist as mnist # Usin ...

  4. 论文笔记:CNN经典结构1(AlexNet,ZFNet,OverFeat,VGG,GoogleNet,ResNet)

    前言 本文主要介绍2012-2015年的一些经典CNN结构,从AlexNet,ZFNet,OverFeat到VGG,GoogleNetv1-v4,ResNetv1-v2. 在论文笔记:CNN经典结构2 ...

  5. tflearn 保存模型重新训练

    from:https://stackoverflow.com/questions/41616292/how-to-load-and-retrain-tflean-model This is to cr ...

  6. tflearn mnist 使用MLP 全连接网络一般都会加dropout哇

    # -*- coding: utf-8 -*- """ Deep Neural Network for MNIST dataset classification task ...

  7. 学过 C++ 的你,不得不知的这 10 条细节!

    每日一句英语学习,每天进步一点点: “Action may not always bring happiness; but there is no happiness without action.” ...

  8. 检测用户命令序列异常——使用LSTM分类算法【使用朴素贝叶斯,类似垃圾邮件分类的做法也可以,将命令序列看成是垃圾邮件】

    通过 搜集 Linux 服务器 的 bash 操作 日志, 通过 训练 识别 出 特定 用户 的 操作 习惯, 然后 进一步 识别 出 异常 操作 行为. 使用 SEA 数据 集 涵盖 70 多个 U ...

  9. 几个小实践带你快速上手MindSpore

    摘要:本文将带大家通过几个小实践快速上手MindSpore,其中包括MindSpore端边云统一格式及华为智慧终端背后的黑科技. MindSpore介绍 MindSpore是一种适用于端边云场景的新型 ...

随机推荐

  1. 并发编程学习笔记(11)----FutureTask的使用及实现

    1. Future的使用 Future模式解决的问题是.在实际的运用场景中,可能某一个任务执行起来非常耗时,如果我们线程一直等着该任务执行完成再去执行其他的代码,就会损耗很大的性能,而Future接口 ...

  2. angular5中的自定义指令(属性指令)

    属性型指令用于改变一个 DOM 元素的外观或行为. 在 Angular 中有三种类型的指令: 组件 — 拥有模板的指令 结构型指令 — 通过添加和移除 DOM 元素改变 DOM 布局的指令 属性型指令 ...

  3. new实现

    前言 本篇来分析new是怎么实现的, 使用c++进行在申请对象的时候用到new, 但是为什么申请对象要用到new, 而不能用malloc, 而有时申请数组的用new或者malloc似乎又都可以, 这里 ...

  4. 数据库中间件MyCat学习总结(1)——MyCat入门简介

    为什么需要MyCat? 虽然云计算时代,传统数据库存在着先天性的弊端,但是NoSQL数据库又无法将其替代.如果传统数据易于扩展,可切分,就可以避免单机(单库)的性能缺陷. MyCat的目标就是:低成本 ...

  5. hdu2852 KiKi's K-Number

    题意:给定三个操作添加删除查询大于a的的第k大值----树状数组的逆向操作 给定a利用BIT查询有多少值比a小,这样比a大的k大值就应该有k+sum(a)个小于他的值 因此可以二分枚举k大值看看是不是 ...

  6. 救命(洛谷 U4525)

    题目背景 XS中学的校长积劳成疾,最终由于无聊而卧病在沙发.需要药(pi)水(gu)拯救他的生活. 题目描述 现在有n种药水,编号分别为1..n,能拯救校长的药水编号为n 每个药水都可以购买到,但有的 ...

  7. 食物链 2001年NOI全国竞赛

    时间限制: 3 s 空间限制: 64000 KB 题目等级 : 钻石 Diamond   题目描述 Description 动物王国中有三类动物 A,B,C,这三类动物的食物链构成了有趣的环形.A吃B ...

  8. 玩一玩MEAN

    参考的书如下: Manning.Getting.MEAN.with.Mongo.Express.Angular.and.Node. 开始再次了解.

  9. WPS for Linux字体配置(Ubuntu 16.04)

    错误提示: 解决方法: 从http://bbs.wps.cn/thread-22355435-1-1.html下载字体库,离线版本:(链接: https://pan.baidu.com/s/1i5dz ...

  10. Ubuntu 16.04安装搜索拼音输入法

    Linux下唯一一款大厂出的输入法 1.下载 http://pinyin.sogou.com/linux/?r=pinyin 2.安装 sudo dpkg -i sogoupinyin_2.1.0.0 ...