目标检测实战4-运行object_detection_tutorial demo

1.前言

本机环境:

TensorFlow(CPU版本):2.0.0-alpha0
python:Python 3.7.1

小记

由于本机环境限制,直接去TensorFlow Models下载模型,结果出现各种报错(未解决),如下:

Error: INFO:tensorflow:Saver not created because there are no variables in the graph to restore

本次记录一次成功的运行demo的过程

2. 过程

2.1 TensorFlow模型下载

1. 网址:模型下载

目标检测实战4-运行object_detection_tutorial demo

2. 解压到本地文件夹,如下所示

目标检测实战4-运行object_detection_tutorial demo

2.2 下载Protobuf(windows中一般选择3.4.0版本)

网址:protocolbuf 3.4.0
目标检测实战4-运行object_detection_tutorial demo

解压文件后,将protoc.exe放到C:\Windows下

目标检测实战4-运行object_detection_tutorial demo

(命令行模式)进入下载到如下路径(解压的TensorFlow models路径):我的路径如下:

G:\python练习\Deep_learn\objectDetec\models-r1.5\research

执行命令(将.proto文件转化为.py文件)

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

目标检测实战4-运行object_detection_tutorial demo
目标检测实战4-运行object_detection_tutorial demo

2.3 下载已经训练好的模型

下载地址训练好的模型

目标检测实战4-运行object_detection_tutorial demo
目标检测实战4-运行object_detection_tutorial demo

2.4 执行程序(jupyter)

由于我的 TensorFlow 版本是 2.0 版本,所以执行过程中需要修改
目标检测实战4-运行object_detection_tutorial demo
模型下载的程序已经被我删除,因为我们已经手动下载了模型

目标检测实战4-运行object_detection_tutorial demo
目标检测实战4-运行object_detection_tutorial demo

修改文件 label_map_util.py
目标检测实战4-运行object_detection_tutorial demo

注:项目中的所有路径,我都使用的绝对路径,出现的错误一般都是TensorFlow的版本问题,或者路径问题

2.5 结果

目标检测实战4-运行object_detection_tutorial demo

3.推荐的博客

知乎文章