分享web开发知识

注册/登录|最近发布|今日推荐

主页 IT知识网页技术软件开发前端开发代码编程运营维护技术分享教程案例
当前位置:首页 > 教程案例

[神经网络]一步一步使用Mobile-Net完成视觉识别(一)

发布时间:2023-09-06 02:19责任编辑:顾先生关键词:暂无标签

1.环境配置

2.数据集获取

3.训练集获取

4.训练

5.调用测试训练结果

  本文是第一篇,环境配置篇。

先打开tensorflow object detection api 看看需要什么配置。

Tensorflow Object Detection API depends on the following libraries:

  • Protobuf 3.0.0
  • Python-tk
  • Pillow 1.0
  • lxml
  • tf Slim (which is included in the "tensorflow/models/research/" checkout)
  • Jupyter notebook
  • Matplotlib
  • Tensorflow (>=1.9.0)
  • Cython
  • contextlib2
  • cocoapi

在安装之前,我们先把这个object detection model 给git下来,在任意目录下,命令行输入以下命令。

git clone https://github.com/tensorflow/models.git

完成之后就能看到一个model文件夹,当然,git命令使用的基础是你已经安装了git,怎么安装git自己百度吧。。

下一步安装tensorflow,安装过的可以直接跳过。

# 如果你要用CPU,就用下面的代码pip install tensorflow#如果你用GPU,就用这里的代码pip install tensorflow-gpu

当然,pip命令使用的基础是你已经安装了pip,如果你不会安装,请自行百度。

我默认你已经完成了上面的操作,下面就开始安装其他东西。

sudo apt-get install protobuf-compiler python-pil python-lxml python-tkpip install --user Cythonpip install --user contextlib2pip install --user jupyterpip install --user matplotlib

命令行里输入以上的命令,完成Cython等库的安装。

下一步至关重要,你需要安装COCOAPI。

在任何一个目录下将cocoapi 给git下来,进入python api目录,编译。

然后进入之前输入make之后的指令,清注意将<path_to_tensorflow>替换为models之前的绝对路径。

git clone https://github.com/cocodataset/cocoapi.gitcd cocoapi/PythonAPImakecp -r pycocotools <path_to_tensorflow>/models/research/

这里你已经完成了很多工作,从models/research执行以下命令

# From tensorflow/models/research/protoc object_detection/protos/*.proto --python_out=.#From tensorflow/models/research/wget -O protobuf.zip https://github.com/google/protobuf/releases/download/v3.0.0/protoc-3.0.0-linux-x86_64.zipunzip protobuf.zip# From tensorflow/models/research/./bin/protoc object_detection/protos/*.proto --python_out=.

这段代码完成了对protobuf的编译工作,这只适用于linux。

接下来就是将pythonpath添加进path

# From tensorflow/models/research/export PYTHONPATH=$PYTHONPATH:`pwd`:`pwd`/slim

接下来就是测试是否安装成功了。

python object_detection/builders/model_builder_test.py

输入以上指令,如果出现

.....................----------------------------------------------------------------------Ran 21 tests in 0.074sOK

表明你安装成功了。准备下一步吧。

[神经网络]一步一步使用Mobile-Net完成视觉识别(一)

原文地址:https://www.cnblogs.com/aoru45/p/9858520.html

知识推荐

我的编程学习网——分享web前端后端开发技术知识。 垃圾信息处理邮箱 tousu563@163.com 网站地图
icp备案号 闽ICP备2023006418号-8 不良信息举报平台 互联网安全管理备案 Copyright 2023 www.wodecom.cn All Rights Reserved