参考链接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. ..\EEP\EEP.c(249): error: #268: declaration may not appear after executable statement in block

    主要原因:  ON_nWP;这个应该放在 unsigned char Delay; unsigned char ReData; 的后面. 修改成功.

  2. Angular全局数据管理与同步更新

    自定义实现angular中数据的状态管理,如有不妥请指正 一.先介绍一下rxjs中subject: Import {subject}from’rxjs’ Subject 数据的订阅与分发,结合报刊的发 ...

  3. 20 - CommonJS - 规范的具体内容

  4. java类加载及new对象的过程

    /* SubClass sub = new SubClass(); 这句话到底做了什么事情呢? 1.javac编译.java源文件形成.class字节码文件; 2.new SubClass()对象时, ...

  5. Java生鲜电商平台-如何使用微服务来架构生鲜电商B2B2C平台?

    Java生鲜电商平台-如何使用微服务来架构生鲜电商B2B2C平台? 说明:随着互联网的日益普及,人们通过手机下单买菜的人越来越多,生鲜这个行业有两个显著的特点,一个是刚需.(你每天都要吃饭,都要吃菜) ...

  6. Codeforces 444C 线段树 懒惰标记

    前天晚上的CF比赛div2的E题,很明显一个线段树,当时还在犹豫复杂度的问题,因为他是区间修改和区间查询,肯定是要用到懒惰标记. 然后昨天真的是给这道题跪了,写了好久好久,...我本来是写了个add标 ...

  7. Maven - web 实例

    版权所有,未经授权,禁止转载 章节 Maven – 简介 Maven – 工作原理 Maven – Repository(存储库) Maven – pom.xml 文件 Maven – 依赖管理 Ma ...

  8. Android进阶——学习AccessibilityService实现微信抢红包插件

    在你的手机更多设置或者高级设置中,我们会发现有个无障碍的功能,很多人不知道这个功能具体是干嘛的,其实这个功能是为了增强用户界面以帮助残障人士,或者可能暂时无法与设备充分交互的人们 它的具体实现是通过A ...

  9. nodejs(14)express获取url中的参数

    问号传参获取参数 获取 http://127.0.0.1:3001/user?id=10&name=zs 中的查询参数: 直接使用 req.query 获取参数即可: 注意:URL 地址栏中通 ...

  10. ZOJ 1276 DP

    给出一系列的1x2的矩阵,要你求出矩阵以什么样的次序相乘才使得相乘次数最少,.(不用排序,只要决定该矩阵是和前面相乘比较好,还是后面). 今天仔细想了一下,跟之前做的DP题目做了下对比,你比如说猴子堆 ...