参考链接https://github.com/tensorflow/models/blob/master/object_detection/g3doc/running_pets.md

先参考https://github.com/tensorflow/models/blob/master/object_detection/g3doc/installation.md安装好环境

以下默认都在models目录下操作

mkdir petstrain

注意PYTHONPATH库路径的设置

# From tensorflow/models/
export PYTHONPATH=$PYTHONPATH:`pwd`:`pwd`/slim

下载Oxford-IIIT Pets的图片和标注信息

# From tensorflow/models/
cd petstrain
wget http://www.robots.ox.ac.uk/~vgg/data/pets/data/images.tar.gz
wget http://www.robots.ox.ac.uk/~vgg/data/pets/data/annotations.tar.gz
tar -xvf images.tar.gz
tar -xvf annotations.tar.gz
cd ..

转换成TFRecord格式

# From tensorflow/models/
cp object_detection/data/pet_label_map.pbtxt petstrain/
python3 object_detection/create_pet_tf_record.py --label_map_path=petstrain/pet_label_map.pbtxt --data_dir=petstrain --output_dir=petstrain

在petstrain目录生成pet_train.record    pet_val.record

下载预训练的模型

cd petstrain
wget http://storage.googleapis.com/download.tensorflow.org/models/object_detection/faster_rcnn_resnet101_coco_11_06_2017.tar.gz
tar -xvf faster_rcnn_resnet101_coco_11_06_2017.tar.gz
mv faster_rcnn_resnet101_coco_11_06_2017/model.ckpt.* .
cd ..

修改配置文件

cp object_detection/samples/configs/faster_rcnn_resnet101_pets.config petstrain/

# From tensorflow/models/

# Edit the faster_rcnn_resnet101_pets.config template. Please note that there
# are multiple places where PATH_TO_BE_CONFIGURED needs to be set.
sed -i "s|PATH_TO_BE_CONFIGURED|petstrain|g" petstrain/faster_rcnn_resnet101_pets.config

训练的目录下会有以下文件

  + petstrain/
- faster_rcnn_resnet101_pets.config
- model.ckpt.index
- model.ckpt.meta
- model.ckpt.data-00000-of-00001
- pet_label_map.pbtxt
- pet_train.record
- pet_val.record

开始训练

# From tensorflow/models/
python3 object_detection/train.py --logtostderr --pipeline_config_path=petstrain/faster_rcnn_resnet101_pets.config  --train_dir=petstrain/res/

查看训练进度

# From tensorflow/models/
tensorboard --logdir=pet-train/res/

打开浏览器localhost:6006

导出训练好的图

# From tensorflow/models/

object_detection/export_inference_graph.py --input_type image_tensor \
    --pipeline_config_path petstrain/faster_rcnn_resnet101_pets.config \
    --checkpoint_path petstrain/res/model.ckpt-445 \
    --inference_graph_path petstrain/output_inference_graph.pb

这样便得到output_inference_graph.pb文件

tensorflow训练Oxford-IIIT Pets的更多相关文章

  1. 目标检测 的标注数据 .xml 转为 tfrecord 的格式用于 TensorFlow 训练

    将目标检测 的标注数据 .xml 转为 tfrecord 的格式用于 TensorFlow 训练. import xml.etree.ElementTree as ET import numpy as ...

  2. 自己搞了20万张图片100个分类,tensorflow训练23万次后。。。。。。

    自己搞了20万张图片100个分类,tensorflow训练23万次后...... 我自己把训练用的一张图片,弄乱之后做了一个预测 100个汉字,20多万张图片,tensorflow CNN训练23万次 ...

  3. tensorflow训练了10万次,运行完毕,对这个word2vec终于有点感觉了

    tensorflow训练了10万次,运行完毕,对这个word2vec终于有点感觉了 感觉它能找到词与词之间的关系,应该可以用来做推荐系统.自动摘要.相关搜索.联想什么的 tensorflow1.1.0 ...

  4. 2、TensorFlow训练MNIST

    装载自:http://www.tensorfly.cn/tfdoc/tutorials/mnist_beginners.html TensorFlow训练MNIST 这个教程的目标读者是对机器学习和T ...

  5. tensorflow训练验证码识别模型

    tensorflow训练验证码识别模型的样本可以使用captcha生成,captcha在linux中的安装也很简单: pip install captcha 生成验证码: # -*- coding: ...

  6. TensorFlow训练MNIST报错ResourceExhaustedError

    title: TensorFlow训练MNIST报错ResourceExhaustedError date: 2018-04-01 12:35:44 categories: deep learning ...

  7. TensorFlow.训练_资料(有视频)

    ZC:自己训练 的文章 貌似 能度娘出来很多,得 自己弄过才知道哪些个是坑 哪些个好用...(在CSDN文章的右侧 也有列出很多相关的文章链接)(貌似 度娘的关键字是"TensorFlow ...

  8. 使用TensorFlow训练自己的语音识别AI

    这次来训练一个基于CNN的语音识别模型.训练完成后,我们将尝试将此模型用于Hotword detection. 人类是怎样听懂一句话的呢?以汉语为例,当听到"wo shi"的录音时 ...

  9. TensorFlow 训练好模型参数的保存和恢复代码

    TensorFlow 训练好模型参数的保存和恢复代码,之前就在想模型不应该每次要个结果都要重新训练一遍吧,应该训练一次就可以一直使用吧. TensorFlow 提供了 Saver 类,可以进行保存和恢 ...

随机推荐

  1. Android-寒假学习-阶段总结(20集)-口算测试APP

    说在前面: 1.视频教程:https://www.bilibili.com/video/av60445113/?spm_id_from=333.788.videocard.0 2.老师的源码:http ...

  2. CSS实现背景图片透明和文字不透明效果

    1.毛玻璃效果:背景图 + 伪类 + flite:blur(3px) width: 500px; height: 300px; line-height: 50px; text-align: cente ...

  3. C/C++ SQLite 之基础篇

    文章目录:                   1. 下载 SQLite3 源码: 2. 下载 SQLite3.dll 文件: 3. 生成 SQLite3.lib 文件 : 4. 生成或者下载 SQL ...

  4. 【LeetCode】四数之和

    [问题]给定一个包含 n 个整数的数组 nums 和一个目标值 target,判断 nums 中是否存在四个元素 a,b,c 和 d ,使得 a + b + c + d 的值与 target 相等?找 ...

  5. java切换jdk版本

    目的:将jdk1.7切换为jdk1.6 1.原本安装了jdk1.7,环境变量也是配置的1.7相关路径,在cmd下输入[java -version]后,显示 [ C:\Users\Administrat ...

  6. 考研c语言基础 66++6

    1.数据类型 对于基本的数据类型,如整型int,long,...(考研中涉及处理的整数题目,如果没有特别要求用int足够了),字符型char,浮点型float.double...(对于处理小数问题,在 ...

  7. Relu激活函数的优点

    Relu优点: 1.可以使网络训练更快. 相比于sigmoid.tanh,导数更加好求,反向传播就是不断的更新参数的过程,因为其导数不复杂形式简单. 2.增加网络的非线性. 本身为非线性函数,加入到神 ...

  8. vue实现CheckBox与数组对象绑定

    实现需求: 实现一个简易的购物车,页面的表格展示data数据中的一个数组对象,并提供选中商品和全选商品checkbox复选框,页面实时显示选中商品的总金额: 分析: 1:使用v-for循环渲染arra ...

  9. python 进程和线程(2)

    这篇博客是按照博客<进程和线程(1)>中内容用futures改写  with futures.ProcessPoolExecutor() as executor:可以两篇博客对照看. 2改 ...

  10. 113.Pageinator和Page类常用的属性和方法

    Paginator和Page类: Paginator和Page类都是用来分页的,他们在Django中的路径为django.core.paginator.Pageinator和django.core.p ...