win10 Tensorflow Object Detection API配置

此文基于:数据集(PascalVOC).xml转.record

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

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

解压添加到环境变量:

 

解压下载好的 models-master ,进入目录:models-master\research 执行命令:

报错:object_detection/protos/*.proto: No such file or directory

解决方法有二:

1 . 用3.4.0版本即可 ,下载地址:https://github.com/google/protobuf/releases/tag/v3.4.0

2. shift+右键 的Windows powershell中使用以下命令可以全部编译:PS:  CMD下无法使用该命令。

 

测试安装是否成功
同样在D:\TensorFlow\models-master\research路径下执行:

如果出现以下现象,说明安装成功:

如果出现以下现象:

解决的方法:
在C:\Users\用户名\Anaconda3\Lib\site-packages添加一个tensorflow_model.pth路径文件,

必须以.pth为后缀,写上你要加入的模块文件所在的目录路径。以我电脑为例:

D:\github\models-master\research
D:\github\models-master\research\slim

 

测试 Object Detection Demo

\models-master\research\object_detection路径下执行命令:jupyter notebook

此时会在浏览器打开的一个界面,如果空白加载不出来择需要刷新:

下滑找到object_detection_tutorial.ipynb文件,点击。
 在打开的object_detection_tutorial.ipynb中找到cell然后运行Run All或者一条一条的运行,直到最后

如果报警告 :

解决:

原先的

修改之后 ->把“from matplotlib import pyplot as plt”这句放到最后

 

第一次运行需要下载模型

当模型下载完毕或我们用自己的模型时Models Download这块代码可以注释掉,否则可能会出现httperror

下面是识别出来的效果图。如果想更换,在object_tetection文件夹中的【test_images】文件夹中可以更改图片。

或者在源代码中修改图像存储的路径,改变【PATH_TO_TEST_IMAGES_DIR】 的路径,

要在models-master\object_detection目录下。相应的数量for i in range(1, 3)也要进行改变

qihong lu

发表评论