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. loadrunner:参数类型及其取值机制

    参数类型 参数名随意取,建议取通俗易懂的名字,下面我们重点介绍一下参数的类型. ●DateTime: 很简单, 在需要输入日期/时间的地方, 可以用DateTime 类型来替代. 其属性设置也很简单, ...

  2. github使用介绍

    github是个比较火的分布式版本管理工具,适合多人协同工作,感觉比svn好.下面简单介绍一下github使用以及把本地代码和github同步的方法. 首先注册账号 https://github.co ...

  3. 理解Node.js(译文)

    前言 总括 :这篇文章十分生动形象的的介绍了Node,满足了读者想去了解Node的需求.作者是Node的第一批贡献者之一,德国前端大神.译者觉得作者的比喻很适合初学者理解Node,特此翻译. 译者 : ...

  4. 笑谈ArcToolbox (4) 非我族类

    笑谈ArcToolbox (4) 非我族类 by 李远祥 ArcToolbox的工具既能直接对数据源进行处理,也能对图层以及被选择要素进行处理.但有些数据看起来是空间数据,但实际上在处理的时候还是会出 ...

  5. GIS制图课程前言

    一直以来都想写一本关于电子地图制图的工具书,把过去所遇到的关于电子地图制图的种种方法.技巧和问题进行总结和归纳,传播电子地图制图的思路和心得. 从2010年开始,陆陆续续在华南地区开展了多场的电子地图 ...

  6. 记录UITextField删除状态

    self.testTextField.leftView = [[UIView alloc] initWithFrame:CGRectMake(, , , )]; self.testTextField. ...

  7. list、set、map以及array的区别

    对于刚刚学习集合框架来说,如何选择list.set.map以及array是比较模糊的 在此我将对这四种情况做总结: array:数组,可以存储对象和基本数据类型,长度固定. Collection:集合 ...

  8. Ubuntu 14.04 64bit 系统下打开PHPadmin时出现缺少mysqli|mysql 扩展的解决方法(php5)

    网上找了很多方法,都是翻来覆去的抄袭. 都在说把 /etc/php5/apache2/php.ini 下面的  ;extension=php_mysqli.dll  前面的 ; 注释符号去掉 再重启 ...

  9. 众人拾柴火焰高之Tomcat集群

    一人拾柴火不旺,众人拾柴火焰高.Tomcat服务器也是一样,一台服务器再强大能承受的访问也是有限的.要提供高并发.高可用的服务,就必须横向扩展,多台Tomcat组成一个集群,根据实际的访问量动态增减服 ...

  10. Java Web(七) JSTL标签库

    在之前我们学过在JSP页面上为了不使用脚本,所以我们有了JSP内置的行为.行为只能提供一小部分的功能,大多数的时候还是会用java脚本,接着就使用了EL表达式,基本上EL表达式看似能满足我们的要求,它 ...