There is Inception-v3 model python implementation on GitHub at: https://github.com/tensorflow/models/tree/master/inception

There are several shell scripts in /inception/inception/data folder. these scripts only can run on Linux OS, especially on Ubuntu. So. how can we set up the Inception-v3 model on Windows. let's dive into these scripts code.

In download_and_preprocess_flowers.sh. first, the script download flower_photo.tgz file from the web. second, make some directories and set some environment. these folders are used to store flowers data and flower train and validate data after processing. almost environment variables are used as the argument in last scripts call.

  • DATA_DIR : root directory after unpacking flower_photo.tgz file.
  • TRAIN_DIRECTORY : the sub-directory of flower data. always be "flowers-data/raw-data/train".
  • VALIDATION_DIRECTORY: the sub-directory of flower data that store pictures for validating. always be "flowers-data/raw-data/validation".
  • LABELS_FILE: the file path of lable.txt, always be "flowers-data/raw-data/labels.txt".
  • OUTPUT_DIRECTORY : somewhere to store processed data.

Then, the script will call another script build_image_data.py.

There are some arguments in this script. we can use environment variables we just set before or set the specific path to these arguments. notice, we just call the build_image_data.py script directly with a command: python build_image_data.py --train_directory="${TRAIN_DIRECTORY}" --validation_directory="${VALIDATION_DIRECTORY}" --output_directory="${OUTPUT_DIRECTORY}" --labels_file="${LABELS_FILE}

this script will convert separated pictures to a union file batch with TFRecords format with Examples protos.

The Example proto:
contains the following fields:

image/encoded: string containing JPEG encoded image in RGB colorspace
image/height: integer, image height in pixels
image/width: integer, image width in pixels
image/colorspace: string, specifying the colorspace, always 'RGB'
image/channels: integer, specifying the number of channels, always 3
image/format: string, specifying the format, always'JPEG'

image/filename: string containing the basename of the image file
e.g. 'n01440764_10026.JPEG' or 'ILSVRC2012_val_00000293.JPEG'
image/class/label: integer specifying the index in a classification layer.
The label ranges from [0, num_labels] where 0 is unused and left as
the background class.
image/class/text: string specifying the human-readable version of the label
e.g. 'dog'

After processing, we can find some training and validation files in the DATA_DIR. 

Before training. we have to do some adjustment to the source code. because Inception-v3 is written with an older version of tensorflow. some API has already discarded.

  • tf.scalar_summary    ->  tf.summary.scalar
  • tf.histogram_summary -> tf.summary.histogram
  • tf.merge_summary  -> tf.summary.merge
  • tf.train.SummaryWriter -> tf.summary.FileWriter
  • tf.concat(0,[ymin, xmin, ymax, xmax]) -> tf.concat([ymin, xmin, ymax, xmax],0)  switch argument.

      Maybe, there also has some error. just look up tensorflow documentation and change it.

We also need to do one step in addition before we start training. cause these python scripts are separated not in a python package. we need to add an empty __init__.py file to inception folder. and make a replica of flowers_train.py on parent-directory. then execute this script.

Make sure you have already installed tensorflow on your windows. notice, tensorflow only supports python 3.4+ on Windows, and there are two types tensorflow, one is CPU only, another is tensorflow-GPU. if you have a GPU have enough compute ability, you can choose the GPU version.  check Installing guide on the tensorflow website is helpful. https://www.tensorflow.org/install/install_windows

We will discuss some arguments in flower_train.py in after articles.

How to set up Tensorflow inception-v3 model on Windows的更多相关文章

  1. 脸型分类-Face shape classification using Inception v3

    本文链接:https://blog.csdn.net/u011961856/article/details/77984667函数解析github 代码:https://github.com/adoni ...

  2. Inception V3 的 tensorflow 实现

    tensorflow 官方给出的实现:models/inception_v3.py at master · tensorflow/models · GitHub 1. 模型结构 首先来看 Incept ...

  3. 源码分析——迁移学习Inception V3网络重训练实现图片分类

    1. 前言 近些年来,随着以卷积神经网络(CNN)为代表的深度学习在图像识别领域的突破,越来越多的图像识别算法不断涌现.在去年,我们初步成功尝试了图像识别在测试领域的应用:将网站样式错乱问题.无线领域 ...

  4. 微调Inception V3网络-对Satellite分类

    目录 1. 流程概述 2. 准备数据集 2.1 Satellite数据集介绍 3. Inception V3网络 4. 训练 4.1 基于Keras微调Inception V3网络 4.2 Keras ...

  5. 1、VGG16 2、VGG19 3、ResNet50 4、Inception V3 5、Xception介绍——迁移学习

    ResNet, AlexNet, VGG, Inception: 理解各种各样的CNN架构 本文翻译自ResNet, AlexNet, VGG, Inception: Understanding va ...

  6. How to setup Tensorflow inception-v3 model on Windows

    There is Inception-v3 model python implementation on GitHub at: https://github.com/tensorflow/models ...

  7. 网络结构解读之inception系列四:Inception V3

    网络结构解读之inception系列四:Inception V3   Inception V3根据前面两篇结构的经验和新设计的结构的实验,总结了一套可借鉴的网络结构设计的原则.理解这些原则的背后隐藏的 ...

  8. 从GoogLeNet至Inception v3

    从GoogLeNet至Inception v3 一.CNN发展纵览 我们先来看一张图片: 1985年,Rumelhart和Hinton等人提出了后向传播(Back Propagation,BP)算法( ...

  9. 经典分类CNN模型系列其五:Inception v2与Inception v3

    经典分类CNN模型系列其五:Inception v2与Inception v3 介绍 Inception v2与Inception v3被作者放在了一篇paper里面,因此我们也作为一篇blog来对其 ...

随机推荐

  1. Android离线缓存

    android做到一定程度,需要考虑缓存的问题,不信可以掏出手机看看淘宝等一些app是否无网的情况下还可以浏览,不过大部分app并没有考虑到这些问题,解决Android的缓存有哪些方法呢 1.IO流读 ...

  2. 《JAVASCRIPT高级程序设计》闭包

    一.闭包的概念 闭包是JAVASCRIPT中最重要的概念之一,闭包是指有权访问另一个函数作用域中变量的函数:创建闭包常见的方式,就是在一个函数内部,创建另一个函数.以下的例子创建了一个闭包,加粗的两行 ...

  3. Python自然语言处理学习笔记之信息提取步骤&分块(chunking)

    一.信息提取模型 信息提取的步骤共分为五步,原始数据为未经处理的字符串, 第一步:分句,用nltk.sent_tokenize(text)实现,得到一个list of strings 第二步:分词,[ ...

  4. 解析.NET对象的跨应用程序域访问(下篇)

    转眼就到了元宵节,匆匆忙忙的脚步是我们在为生活奋斗的写照,新的一年,我们应该努力让自己有不一样的生活和追求.生命不息,奋斗不止.在上篇博文中主要介绍了.NET的AppDomain的相关信息,在本篇博文 ...

  5. gRPC中Any类型的使用(Java和NodeJs端)

    工作中要把原来Java服务端基于SpringMVC的服务改为使用gRPC直接调用.由于原Service的返回值为动态的Map类型,key值不确定,且value的类型不唯一,因此使用了protobuf ...

  6. 学习 OpenStack 的方法论 - 每天5分钟玩转 OpenStack(150)

    作为 OpenStack 的核心教程,我们已经到了最后总结的部分. OpenStack 目前已经有好几十个模块,本教程讨论的是最最重要的核心模块:Keystone,Nova,Glance,Cinder ...

  7. c#入门系列——类和对象的代码实现

    面向对象 说起面向对象,大家因该都听说过,也知道是一个编程的方法,简称oop技术.它将对象的算法和数据结构看作一个整体,而一个程序就是由多个对象结合的整体.这样做可以提高代码的复用率,提高了软件的可维 ...

  8. iOS 启动页后广告Demo

    重点! 对于启动页后的广告,相信大家也都看到过很多很多的,比如我自己常看到的有 QQ音乐,爱奇艺了.你点击了APP,它会启动就会随之启动..其实这些APP的启动页是没有消失的,你去认真的观察一下!所以 ...

  9. java Socket(TCP)编程小项目

    package 服务器端相关操作; import java.io.Serializable; /* * 创建存储需要传输信息的对象,方便客户端向服务器端传送数据 */ public class Cli ...

  10. Asp.Net MVC学习总结(一)——Asp.Net MVC简单入门

    一.MVC简单入门 1.1.MVC概念 视图(View) 代表用户交互界面,对于Web应用来说,可以概括为HTML界面,但有可能为XHTML.XML和Applet. 模型(Model) 表示用户对其数 ...