基于win10,GPU的Tensorflow Object Detection API部署及USB摄像头目标检测
来源:互联网 发布:java 日志级别设置 编辑:程序博客网 时间:2024/05/22 05:23
- TensorFlow安装
- 下载 TensorFlow models
- 配置依赖库
- 程序配置和运行
1.TensorFlow安装
安装教程在CSDN上有很多文章,但最好依据官方教程,因为TensorFlow不断更新,需要的CUDA、cudnn等版本也在变化。官方地址在GITHUB里TensorFlow项目下可以找到安装指南,https://www.tensorflow.org/install/。这里我选择的是Anaconda安装,方便统一管理。
考虑到翻墙的原因,打不开官方网站的看这里:
(1)Requirements to run TensorFlow with GPU support
If you are installing TensorFlow with GPU support using one of the mechanisms described in this guide, then the following NVIDIA software must be installed on your system:
CUDA® Toolkit 8.0. For details, see NVIDIA’s documentation Ensure that you append the relevant Cuda pathnames to the %PATH% environment variable as described in the NVIDIA documentation.
The NVIDIA drivers associated with CUDA Toolkit 8.0.cuDNN v6.1. For details, see NVIDIA’s documentation. Note that cuDNN is typically installed in a different location from the other CUDA DLLs. Ensure that you add the directory where you installed the cuDNN DLL to your %PATH% environment variable.
GPU card with CUDA Compute Capability 3.0 or higher. See NVIDIA documentation for a list of supported GPU cards.If you have a different version of one of the preceding packages, please change to the specified versions. In particular, the cuDNN version must match exactly: TensorFlow will not load if it cannot find cuDNN64_6.dll. To use a different version of cuDNN, you must build from source.
(2)Requirements to run TensorFlow with GPU support
- The Anaconda installation is community supported, not officially supported.
Take the following steps to install TensorFlow in an Anaconda environment:
Follow the instructions on the Anaconda download site to download and install Anaconda.
Create a conda environment named tensorflow by invoking the following command:
C:> conda create -n tensorflow python=3.5
- Activate the conda environment by issuing the following command:
C:> activate tensorflow (tensorflow)C:> # Your prompt should change
- Issue the appropriate command to install TensorFlow inside your conda environment. To install the CPU-only version of TensorFlow, enter the following command:
(tensorflow)C:> pip install --ignore-installed --upgrade tensorflow
- To install the GPU version of TensorFlow, enter the following command (on a single line):
(tensorflow)C:> pip install --ignore-installed --upgrade tensorflow-gpu
(3)安装后日常使用时打开shell窗口,我用的conEmu,激活TensorFlow环境再执行。
activate tensorflow
2.下载 TensorFlow models
地址:https://github.com/tensorflow/models
git clone 到本地目录。
3.配置依赖库
- 利用Anaconda安装protobuf:
conda install protobuf
- 编译Protobuf库,在object_detection同级目录打开终端运行:
cd E:\TensorFlow\GitHub\models\researchprotoc object_detection\protos\*.proto --python_out=.
- 在research目录下运行:
python setup.py install
- 进入slim目录运行:
python setup.py install
- 添加环境变量:
- 返回research目录测试环境是否准备完毕:
python object_detection/builders/model_builder_test.py
若出现缺乏相关库的提示,根据提示利用conda install安装,若仍然失败,重复(3)(4)
4.程序配置和运行
- 选择模型:
Tensorflow detection model zoo
# What model to download. MODEL_NAME = 'ssd_mobilenet_v1_coco_11_06_2017' #MODEL_NAME = 'faster_rcnn_resnet101_coco_11_06_2017'#MODEL_NAME = 'ssd_inception_v2_coco_11_06_2017'MODEL_FILE = MODEL_NAME + '.tar.gz' DOWNLOAD_BASE = 'http://download.tensorflow.org/models/object_detection/'
- USB摄像头采集需要安装opencv_python
下载:https://www.lfd.uci.edu/~gohlke/pythonlibs/#opencv
根据自己的python版本选择相应版本:
python --version
我的是3.5.4,所以我选择:opencv_python-3.3.1-cp35-cp35m-win_amd64.whl
安装:
pip install opencv_python-3.3.0-cp35-cp35m-win_amd64.whl
- 编写视频采集及目标检测代码,运行
python webcamdetect.py
- 代码:
积分支持http://download.csdn.net/download/asukasmallriver/10141937
参考文献:
目标检测笔记二:Object Detection API 小白实践指南
TensorFlow:Object_Detection_API在Windows10上的配置
- 基于win10,GPU的Tensorflow Object Detection API部署及USB摄像头目标检测
- 计算机视觉实时目标检测 TensorFlow Object Detection API
- 基于视频的移动目标检测 Moving Object Detection
- TensorFlow Object Detection API
- Tensorflow Object Detection API
- TensorFlow Object Detection API
- Tensorflow训练自己的Object Detection模型并进行目标检测
- 使用TensorFlow Object Detection API进行图像物体检测
- 基于ROS 目标检测与识别-Object Detection and Recognition
- 目标检测(Object Detection)
- 基于深度学习的目标检测(object detection)—— rcnn、fast-rcnn、faster-rcnn
- 测试TensorFlow Object Detection API
- tensorflow object detection API安装
- TensorFlow Object Detection API 介绍
- 安装 Tensorflow Object Detection API
- TensorFlow Object Detection API 实践
- 修改TensorFlow Object Detection API
- TensorFlow Object Detection API 教程
- 加湿电热管特点
- YUM
- javafx的fxmlLoader1.getController();返回null
- CodeForces 472 D ,E,F (MST,构造,线性代数)(待补)
- java 获取IP所在地
- 基于win10,GPU的Tensorflow Object Detection API部署及USB摄像头目标检测
- 网口模块DP83848的使用
- SpringMVC学习第一章:HelloWorld
- 使用Filter和Interceptor拦截REST服务(四)
- 链表的销毁
- 有1,2,3,4四个数字,能组成多少个互不相同且无重复数字的三位数?都是多少?
- echars的使用
- 一个对List中的数据进行分页的工具类
- 【Luogu3455】【POI2007】ZAP-Queries(莫比乌斯反演)