Tensorflow Object Detection API目标检测(环境配置篇)--修订中

由于卤煮本人在做的项目需要目标检测方面的东西,故此将自己的经历记录下来。

参考博客如下:站在巨人的肩膀上,总能看到更高更远的风光。

https://www.meiwen.com.cn/subject/dervjqtx.html

https://cryer.github.io/2018/04/object_detection/

环境:WIN10 64 + PyCharm Community Edition 2019.1.1 x64 + Anaconda3 5.0.0 64bit(默认包含python 3.6.2)

  • 安装tensorflow:(关于TensorFlow的安装我会在后续的帖子中单独的列出来),卤煮安装的版本是tensorflow 1.13.1。tensorflow安装的过程中遇到的坑实在是太多了,别人遇到的卤煮也遇到了,别人没遇到的卤煮也遇到了(笑哭)。tensorflow官网:https://tensorflow.google.cn
  • 安装 Tensorflow Object Detection API。下载地址:https://github.com/tensorflow/models。下载之后解压,保存的路径不要太深,免得在代码中添加路径的时候路径过长。
  • 安装protobuf 编译器必须是protoc-3.4.0-win32,其他的版本都运行不了,卤煮亲测,都是泪。地址https://github.com/protocolbuffers/protobuf/releases?after=v3.4.1,如果这个地址不行的话,直接在百度上找,但一定是要3.4.0版本。
  • Tensorflow Object Detection API目标检测(环境配置篇)--修订中
  • 下载图片,制作自己的数据集。卤煮下载了十张梅西的照片(嘿嘿,梅老板的粉丝),我的选取原则是尽量选择全身照,如果是做人脸识别的话,尽量先选择正脸,或者是光线好的照片。。。。。
  • 安装标记工具labelImg: 下载地址:https://github.com/tzutalin/labelImg。我当时下载之后就直接解压了,后来看到相关的博客说labelImg的运行环境必须是python3.6,由于我安装的anaconda中默认的是Python3.6.2,所以没注意。如果是其他的python版本也可以,欢迎指出来。
  • 运行labelImg,将标记工具解压之后,找到labelImg.py,在命令行下执行下面的命令,注意是自己解压之后的路径。这样,安装标记工具就运行起来了。

C:\Users\LP>d:

D:\>cd D:\Workspaces\ObjectDetection\labelImg-master\labelImg-master

D:\Workspaces\ObjectDetection\labelImg-master\labelImg-master>python labelImg.py

注意,D:\Workspaces\ObjectDetection\labelImg-master\labelImg-master这个是我自己的路径,大家运行的时候改成自己的路径

  • 对实例进行运行测试:

base) C:\Users\LP\Documents>d:

(base) D:\>cd D:\Workspaces\ObjectDetection\models-master\models-master\research\object_detection

(base) D:\Workspaces\ObjectDetection\models-master\models-master\research\object_detection>jupyter-notebook

注意更改为自己的路径。

训练的结果如下:

Tensorflow Object Detection API目标检测(环境配置篇)--修订中Tensorflow Object Detection API目标检测(环境配置篇)--修订中

放几张我自己训练的结果:

Tensorflow Object Detection API目标检测(环境配置篇)--修订中

 

Tensorflow Object Detection API目标检测(环境配置篇)--修订中

Tensorflow Object Detection API目标检测(环境配置篇)--修订中 

Tensorflow Object Detection API目标检测(环境配置篇)--修订中