tensorflow object detection API安装

http://blog.csdn.net/u010122972/article/details/77385793


终端进入models根目录 ==>>  models/research

object_detection 能够对ssd_mobilenets进行训练,为了体验效果,对object_detection 进行了安装

1.安装依赖项

我的是ubuntu 14.04,故在终端中输入如下命令

sudo pip install pillow
sudo pip install lxml
sudo pip install jupyter
sudo pip install matplotlib

如果是ubuntu 16.04,可输入:

sudo apt-get install protobuf-compiler python-pil python-lxml
sudo pip install jupyter
sudo pip install matplotlib

2.编译protobuf

终端进入models根目录,输入

protoc object_detection/protos/*.proto --python_out=.

(默认已经安装protobuf)

3.添加库路径

终端进入models根目录,输入

export PYTHONPATH=$PYTHONPATH:`pwd`:`pwd`/slim

每次终端都需要输入一次

4.验证

终端进入models根目录,输入

python object_detection/builders/model_builder_test.py

若显示OK,则已经成功安装


===============================update===================================

http://blog.csdn.net/u010302327/article/details/78248394

train自己的pb:

1. python object_detection/train.py --train_dir object_detection/train --pipeline_config_path object_detection/VOC2012/ssd_mobilenet_v1_voc2012.config

报错:

https://github.com/tensorflow/models/issues/1817

2017-06-29 17:24:13.193833: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1030] Creating TensorFlow device (/gpu:7) -> (device: 7, name: Tesla K80, pci bus id: 0000:00:0b.0)
2017-06-29 17:24:15.414228: I tensorflow/core/common_runtime/simple_placer.cc:675] Ignoring device specification /device:GPU:0 for node 'prefetch_queue_Dequeue' because the input edge from 'prefetch_queue' is a reference connection and already has a device field set to /device:CPU:0
INFO:tensorflow:Restoring parameters from /home/ubuntu/models/data_xxxx/model.ckpt
INFO:tensorflow:Starting Session.
INFO:tensorflow:Saving checkpoint to path data_doliprane/model.ckpt
INFO:tensorflow:Starting Queues.
INFO:tensorflow:global_step/sec: 0
[1]    4359 killed     python object_detection/train.py --train_dir=data_xxxx 


1.1 修改如下,错误依旧:

https://stackoverflow.com/questions/45150773/tensorflow-object-detection-training-killed-resource-starvation

To quote from the issue, with my comments:

The section in your new config will look like this:

train_input_reader: { tf_record_input_reader { input_path: "PATH_TO_BE_CONFIGURED/pet_train.record" } label_map_path: "PATH_TO_BE_CONFIGURED/pet_label_map.pbtxt"queue_capacity: 100 # change this number min_after_dequeue: 10 # change this number (strictly less than the above) }

You can also set these for eval_input_reader. For this one I am using 20, 10 and for train I use 100, 10, although I think I could go lower. My training takes less than 8Gb of RAM.

1.2 修改如下,可以跑了:
Hi again guys, we have found a solutionchanging the  batch_size  to one. By default this parameter is set to 32, so probably this needs too much RAM.
I don't understand why this is consuming this extremely amount of RAM, but you can change this and train a model in a  normal  environment.


2. thus we have a pb file.....

$ python object_detection/export_inference_graph.py --input_type image_tensor --pipeline_config_path object_detection/VOC2012/ssd_mobilenet_v1_voc2012.config --trained_checkpoint_prefix object_detection/train/model.ckpt-200 --output_directory object_detection/VOC2012/model/

3. tensorborad

jiao@jiao-linux:~/code/source/tensorflow/models/research$ tensorboard --logdir='home/jiao/code/source/tensorflow/models/reseatch/object_detection/VOC2012/ssd_mobilenet_train_logs'
TensorBoard 0.4.0rc3 at http://jiao-linux:6006 (Press CTRL+C to quit)

4.利用训练好的模型进行图片测试

(1)下载labelimage源码
curl -O https://raw.githubusercontent.com/tensorflow/tensorflow/r1.3/tensorflow/examples/label_image/label_image.py

(2)read it README.md



  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值