参考链接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. POJ 2187:Beauty Contest 求给定一些点集里最远的两个点距离

    Beauty Contest Time Limit: 3000MS   Memory Limit: 65536K Total Submissions: 31414   Accepted: 9749 D ...

  2. BGP联邦配置

    BGP联盟建立: ①:启用BGP进程. ②:关闭同步与自动汇总. ③:router-id ④:公布自己所属联盟.——confederation identifier ID ⑤:表达自己的与其他对等(p ...

  3. Spring(5) -(14) pointcut 语法

    AOP的规范本应该由SUM公司提出,但是被AOP联盟捷足先登.AOP联盟指定AOP规范,首先就要解决一个问题,怎么表示切入点,也就是在哪些方法上增强(where) AspectJ 是一个面向切面的框架 ...

  4. windows elasticsearch-head插件安装教程

    elasticsearch-head下载地址:https://github.com/mobz/elasticsearch-head 1.git下载 git clone git://github.com ...

  5. JDBC批处理方法

    每次新建Connection的时候相当于建了一座桥,每次一辆车(PreparedStatement)运送货物(ResultSet)成本太高! 每次都建立网络连接的时间远远大于本地的时间,为了处理大量的 ...

  6. part7 vuex实现数据共享

    vuex 是数据框架(一个插件)(单项数据的改变流程,组件改数据必须先调Action用dispatch方法) 大型项目vue只能承担视图层的主要内容 大量数据传递的时候,往往需要一个数据框架辅助 例子 ...

  7. python控制鼠标键盘

    1.安装类库 pip install pyautogui 2.代码: import pyautogui,time,random pyautogui.PAUSE = pyautogui.FAILSAFE ...

  8. python导出oracle中的表内容,并生成excel文件

    export NLS_LANG=AMERICAN_AMERICA.ZHS16GBK; ### 如果oracle表中有中文输出,为防止乱码,执行脚本前,需要先制定字符集: #!/usr/bin/pyth ...

  9. Vue框架的介绍及使用

    Vue框架 定义:渐进式 JavaScript 框架 渐进式:可以控制一个页面的一个标签,可以控制一系列标签,也可以控制整个页面,甚至可以控制整个前台项目. 通过对框架的了解与运用程度,来决定其在整个 ...

  10. phpmyadmin拿网站shell

    开门见山 1. 找到一个赌博网站,发现存在php探针界面,在下面输入密码尝试用弱口令进行连接,尝试是否成功 失败的结果是这样. 2. 成功! 3. 连接成功的,点击phpMyAdmin管理,进行弱口令 ...