参考:
https://github.com/tensorflow/models/tree/477ed41e7e4e8a8443bc633846eb01e2182dc68a/object_detection
Building a Real-Time Object Recognition App with Tensorflow and OpenCV
github:https://github.com/datitran/object_detector_app
How to train your own Object Detector with TensorFlow’s Object Detector API github:https://github.com/datitran/raccoon_dataset
Real-time and video processing object detection using Tensorflow, OpenCV and Docker.
github:https://github.com/lbeaucourt/Object-detection
本文是基于ubuntu14.04+tensorflow1.2(cpu)+python3.5+opencv3.1
anaconda常用命令
conda 常用命令 ttps://www.jianshu.com/p/2f3be7781451 ttps://blog.csdn.net/menc15/article/details/71477949
1、首先在anaconda官网上下载anaconda
这里下载的是anconda linux版本(pyton3.6版本)https://www.anaconda.com/download/#linux, 另外安装了python3.5的环境https://conda.io/docs/user-guide/tasks/manage-python.html,
conda create -n py35 python=3.5 anaconda
上述命令中py35为环境名字,python=3.5为我们要创造的python版本,anaconda包含了所需要的所有python包。
2 激活环境
通过以下命令来激活我们所需要的环境
source activate py35
3 安装目标检测库
在github上下载目标检测库https://github.com/datitran/object_detector_app并放到自己的工作路径下即可,或通过命令下载:
git clone https://github.com/datitran/object_detector_app
通过下面链接中的https://github.com/datitran/object_detector_app命令
conda env create -f environment.yml
来创造我们需要的环境,会帮我们安装好相应的tensorflow库以及其他python依赖库,如下面的库
- Protobuf 2.6
- Pillow 1.0
- lxml
- tf Slim (which is included in the “tensorflow/models” checkout)
- Jupyter notebook
- Matplotlib
- Tensorflow 具体可以查看environment.yaml文件 可是会出现如下错误 ``` python (py35) hehe@hehe-OptiPlex-5040:~/anaconda3/envs/object_detector_app-master$ conda env create -f environment.yml Solving environment: failed
ResolvePackageNotFound:
- opencv3==3.0.0=py35_0
- tbb==4.3_20141023=0
可能是源的关系,找不到一些相应的库,于是我们删除找不到的库,具体参考我fork的自己的仓库,由于找不到相应的opencv库,我们通过手动安装相应的库 [https://github.com/duhuazhen/object_detector_app](https://github.com/duhuazhen/object_detector_app) ``` python conda env create -f environment.yml
conda install -c https://conda.anaconda.org/menpo opencv3
对于在anaconda下单独安装tensorflow的方法参考(这里不需要单独安装): https://blog.csdn.net/michaelliang12/article/details/60106686 https://www.cnblogs.com/tiansheng/p/7281290.html
上面的博客是通过把tensorflow下载下来的方式进行安装的我们也可以安装官网的方式https://www.tensorflow.org/install/install_linux来进行安装pip install --ignore-installed --upgrade \https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-1.6.0-cp34-cp34m-linux_x86_64.whl
4 运行目标检测库
python object_detection_app.py Optional arguments (default value): Device index of the camera --source=0 Width of the frames in the video stream --width=480 Height of the frames in the video stream --height=360 Number of workers --num-workers=2 Size of the queue --queue-size=5
来启动物体识别程序。整体来说效果还是可以的
下一步我们将来训练自己的模型。