参考链接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. Maccms后门分析复现(并非官网的Maccms){10.15 第二十二天}

    该复现参考网络中的文章,该漏洞复现仅仅是为了学习交流,严禁非法使用!!!! Maccms官网:http://www.maccms.cn/ Maccms网站基于PHP+MYSQL的系统,易用性.功能良好 ...

  2. SpringBoot+SpringSecurity之如何forword到登录页面

    当我们在项目中引入了SpringSecurity框架进行身份校验的时候,如果某个请求需要用户身份认证,那么SpringSecurity会将用户redirect到登录页面.但是有些时候我们希望是forw ...

  3. ORACLE 将一个库的部分值带条件插入到另外一个库

    将一个表插入另外一个表,两种方法: 1.insert into table1 select * from table2 ; 或者2.create table1 as select * from tab ...

  4. Linux终端命令行的常用快捷键

    history 显示命令历史列表 ↑(Ctrl+p) 显示上一条命令 ↓(Ctrl+n) 显示下一条命令 !num 执行命令历史列表的第num条命令 !! 执行上一条命令 !?string? 执行含有 ...

  5. 线性数据结构案例1 —— 单向链表中获取倒数k个节点

    一.介绍  先遍历整个链表获取链表长度length,然后通过 (length-index) 方式得到我们想要节点在链表中的位置. 二.代码 public Node findLastIndexNode( ...

  6. css代码实现列表等宽

    实现上面的手机页面,我们会遇到一个自适应的问题,但是手机页面的屏幕大小不一致,自适应的问题不是百分比可以好好解决的,我采用下面的布局:display:flex; <!DOCTYPE html&g ...

  7. SQL笔记整理

  8. git本地代码回滚

    git本地操作有时会有误删误改并提交的时候,此时可以通过回滚获得之前的特定版本 1. 查看log 输入  git log  查看commit记录 [xxxxxxx]$ git log 结果大致如下(根 ...

  9. POJ 1836:Alignment

    Alignment Time Limit: 1000MS   Memory Limit: 30000K Total Submissions: 14492   Accepted: 4698 Descri ...

  10. Q7:Reverse Integer

    7. Reverse Integer 官方的链接:7. Reverse Integer Description : Given a 32-bit signed integer, reverse dig ...