Tensorflow Object Detection API 安装 配置 运行demo

Tensorflow Object Detection API

一、需要安装的依赖如下:

Tensorflow Object Detection API 安装 配置 运行demo

1.下载Tensorflow Object Detection API模型

下载地址:https://github.com/tensorflow/models

Tensorflow Object Detection API 安装 配置 运行demo

本地地址:E:\lh\senior\internship\models-master

2.安装配置Protobuf

(1)下载Protobuf

下载地址:https://github.com/protocolbuffers/protobuf/releases

Tensorflow Object Detection API 安装 配置 运行demo

本地地址:E:\lh\senior\internship\protoc-3.4.0-win32

Tensorflow Object Detection API 安装 配置 运行demo

(2)将解压后的bin文件夹路径添加到环境变量中

Tensorflow Object Detection API 安装 配置 运行demo

(3)打开cmd,输入 protoc:输出如下信息则表示添加环境变量成功

Tensorflow Object Detection API 安装 配置 运行demo

(4)将下载的tensorflow object detection文件解压,找到文件夹下的\models-master\research\object_detection\protos目录,利用Protoc将目录中的.proto文件编译成py文件。

cmd下使用cd命令进入到\models\research文件夹下

Tensorflow Object Detection API 安装 配置 运行demo

执行下面的命令:protoc object_detection/protos/*.proto --python_out=.

Tensorflow Object Detection API 安装 配置 运行demo

命令执行结束后:

Tensorflow Object Detection API 安装 配置 运行demo

5)添加环境变量

Tensorflow Object Detection API 安装 配置 运行demo

6)检测是否安装成功

Tensorflow Object Detection API 安装 配置 运行demo

3.安装需要的python库:pillow,  lxml, matplotlib, jupyter

(1)cmd下进入python安装目录下的\Scripts目录

Tensorflow Object Detection API 安装 配置 运行demo

(2)安装Cpython

Tensorflow Object Detection API 安装 配置 运行demo

(3)安装contextlib2

Tensorflow Object Detection API 安装 配置 运行demo

(4)安装pillow

Tensorflow Object Detection API 安装 配置 运行demo

(5)安装lxml

Tensorflow Object Detection API 安装 配置 运行demo

(6)安装jupyter

Tensorflow Object Detection API 安装 配置 运行demo

(7)安装matplotlib

Tensorflow Object Detection API 安装 配置 运行demo

4.COCO API的配置

Tensorflow Object Detection API 安装 配置 运行demo

(1)下载

下载地址:https://github.com/cocodataset/cocoapi

本地地址:E:\lh\senior\internship\cocoapi-master

copy the pycocotools subfolder to the tensorflow/models/research directory

(2)在cmd窗口,cd到\cocoapi-master\PythonAPI目录,执行 python setup.py install命令

Tensorflow Object Detection API 安装 配置 运行demo

出现如下错误:

Tensorflow Object Detection API 安装 配置 运行demo

下载对应的Microsoft Visual C++ 14.0:

https://go.microsoft.com/fwlink/?LinkId=691126

Tensorflow Object Detection API 安装 配置 运行demo

Tensorflow Object Detection API 安装 配置 运行demo

Tensorflow Object Detection API 安装 配置 运行demo

(3)重启后重新执行(2)

Tensorflow Object Detection API 安装 配置 运行demo

Tensorflow Object Detection API 安装 配置 运行demo

5.Python-tk的安装配置

windows下python3.2版本之后是自动安装tkinter的,检查方法如下:

Tensorflow Object Detection API 安装 配置 运行demo

如果出现下面的界面,说明已经安装

 

Tensorflow Object Detection API 安装 配置 运行demo

二、运行自带DEMO

(1)CMD中找到models-master文件夹下

Tensorflow Object Detection API 安装 配置 运行demo

(2)输入:jupyter-notebook

Tensorflow Object Detection API 安装 配置 运行demo

(3)浏览器打开jupyter

Tensorflow Object Detection API 安装 配置 运行demo

(4)找到research\object_detection\object_detection_tutorial.ipynb

Tensorflow Object Detection API 安装 配置 运行demo

(5)点击Cell->Run all,等待结果

Tensorflow Object Detection API 安装 配置 运行demo

Tensorflow Object Detection API 安装 配置 运行demo

Tensorflow Object Detection API 安装 配置 运行demo

 

三、参考教程

1.tensorflow的安装教程
https://tensorflow.google.cn/install/pip

2.Tensorflow object detection API 详细配置教程
https://blog.****.net/zj1131190425/article/details/80711857

3.Tensorflow object detection API下载链接
https://github.com/tensorflow/models/tree/master/research/object_detection

4.COCOAPI下载配置链接
https://github.com/philferriere/cocoapi

API使用和原理
https://blog.****.net/linolzhang/article/details/73730463