zoukankan      html  css  js  c++  java
  • [神经网络]一步一步使用Mobile-Net完成视觉识别(一)

    1.环境配置

    2.数据集获取

    3.训练集获取

    4.训练

    5.调用测试训练结果

    6.代码讲解

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

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

    当然,我写的教程不是很详细,详细的请看官方的教程:https://github.com/tensorflow/models/blob/master/research/object_detection/g3doc/installation.md

    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-tk
    pip install --user Cython
    pip install --user contextlib2
    pip install --user jupyter
    pip install --user matplotlib

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

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

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

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

    git clone https://github.com/cocodataset/cocoapi.git
    cd cocoapi/PythonAPI
    make
    cp -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.zip
    unzip 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.074s
    
    OK

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

  • 相关阅读:
    net 面试题
    Entity Framework Core 三条引用三条命令
    软件开发模型设计
    Mysql局域网共享
    基于WinForm,百度ai接口开发的人脸识别
    WinForm创建
    SQLite Encryption(加密)新姿势
    WPF-MenuItem只显示最后一个Icon
    《深入浅出WPF》-刘铁猛学习笔记——XAML
    为什么你的问题群里没人回答?这就是原因!
  • 原文地址:https://www.cnblogs.com/aoru45/p/9858520.html
Copyright © 2011-2022 走看看