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 setup 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. Setup Tensorflow with GPU on Mac OSX 10.11

    Setup Tensorflow with GPU on OSX 10.11 环境描述 电脑:MacBook Pro 15.6 CPU: 2.7GHz 显卡: GT 650m 系统:OSX 10.11 ...

  7. How to set up Tensorflow inception-v3 model on Windows

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

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

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

  9. 从GoogLeNet至Inception v3

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

随机推荐

  1. 使用linux命令行调整非图形界面分辨率

    第一步,调整linux内核显示参数: 打开内核菜单配置列表文件: vi /boot/grub/menu.lst 或者 vi /boot/grub/gurb.conf 在kernel设置一行末尾添加: ...

  2. Netty 服务端:新连接接入

    本文主要分析服务端新连接的接入过程,主要分为以下 3 各步骤: select 操作: processSelectedKeys 操作. 1. select 操作 在分析 select 操作前,先要回顾一 ...

  3. 两款不错的Linux密码生成工具

    先介绍最简单的方法,Linux自带的 $ strings /dev/urandom | | ; echo whucNWhr35W6ZP0MxrLQ $ /dev/random | base64 | t ...

  4. CentOS 7 yum安装nginx-1.12.0

    CentOS 7 中的 yum 没法直接使用 yum install nginx 这个指令去安装nginx,因为nginx这个服务不是yum库中自带的.图1是官方提供的大致安装步骤,图2是官网提供的多 ...

  5. 网络编程三 Socket

    1.根据netstat端口的找到进程号---->根据进程号找到进程名称-------->终止进程 1) netstat    最后一列是5432 C:\Users\Administrato ...

  6. 如何处理Excel空行问题

    在操作excel的时候, 可能会出现很多的无效数据行. 下面是一个我的简单处理方式 public static bool DataSetToExcel(DataSet dataSet, string ...

  7. 15. Password auditing (密码审核 12个)

    Aircrack是一套用于802.11a / b / g WEP和WPA破解的工具. 一旦收集到足够的加密数据包,它就会实现最有效的破解算法来恢复无线密钥.. 该套件包括十多个分离工具,包括airod ...

  8. 转载 JAVA gc垃圾回收机制

    thanks:https://m.oschina.net/u/123553 一.GC概要 JVM堆相关知识    为什么先说JVM堆?    JVM的堆是Java对象的活动空间,程序中的类的对象从中分 ...

  9. Java_03选择结构

    1.if 选择结构 格式: if(判断条件){ // 语句块 }else if(判断条件){ // 语句块 2 }else{ // 语句块 3 } 当 if 关键字后的一对大括号里只有一个语句时,可以 ...

  10. Actifio如何保护和管理Oracle-带外篇

    引言 本文提供CDS带外环境下相关配置,保护和恢复Oracle的所需步骤. 目的是提供Oracle数据库配置前的详细说明,Actifio环境下发现和配置Oracle数据库,执行还原和恢复,以及配置Or ...