zoukankan      html  css  js  c++  java
  • Win10 Tensorflow 配置Mask_RCNN

    1、安装Anaconda3

    下载地址  Anaconda 官网下载地址:https://www.continuum.io/downloads 

    下载以后,点击exe程序,开始安装,详细的安装过程(图片参考:https://blog.csdn.net/u012318074/article/details/77075209)

    点击 Next

    点击 I Agree

    选择两个钟任意一个,如果是新手,个人建议选择第二个

    选择安装目录,最好不要是中文路径

    这两个都要选择,这样会把Python加入环境变量

    等待安装完成

    2、安装tensorflow

    这里安装的是tensorflow  CPU版本

    安装过程:

    打开开始菜单,选择

    在命令行输入:

    pip install tensorflow==1.6  (1.6为tensorflow版本,具体版本可自定义)

    安装完成以后在命令行输入  python进入python命令行

    然后输入:   import tensorflow as tf       回车,如果不报错,说明tensorflow安装成功

    注:如果想安装tensorflow  GPU版本(GPU版本确实比CPU快,有条件的话推荐安装GPU版本),请先确认自己电脑上是否有GPU(打开驱动精灵或者鲁大师或者360驱动进行硬件检测,看显卡一栏,即可找到GPU),如果有,先安装cuda,然后下载对应版本的cudnn,再运行上面的命令可安装tensorflow-gpu版本

    3、配置Mask_RCNN

    ①下载Mask_RCNN:项目源代码地址:https://github.com/matterport/Mask_RCNN

    ②在COCO数据集上预训练权重(mask_rcnn_coco.h5),

    下载地址:https://github.com/matterport/Mask_RCNN/releases

    下载完成以后放置在Mask_RCNN目录下即可

    ③安装pycocotools

    下载COCO:

    下载地址:https://github.com/philferriere/cocoapi

    下载完成以后在前面打开的Anaconda命令窗口中用cd命令切换到cocoapi下的PythonAPI目录

    然后在命令行输入  python setup.py build_ext --inplace          (注:在此之前确保你的电脑上已经安装了Visual Studio2015,如果Visual Studio没有C++模块,需要打开Visual Studio2015,并安装C++模块,具体安装过程可搜索相关的参考文档)

    安装完成标志:

    -------------------------------------------------

    (E:Anaconda3install1) E:TensorflowcocoapiPythonAPI>python setup.py build_ext --inplace
    running build_ext
    building 'pycocotools._mask' extension
    E:Visual Studio 2015installVCBINx86_amd64cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -IE:Anaconda3install1libsite-packages umpycoreinclude -I../common -IE:Anaconda3install1include -IE:Anaconda3install1include "-IE:Visual Studio 2015installVCINCLUDE" "-IE:Visual Studio 2015installVCATLMFCINCLUDE" "-IC:Program Files (x86)Windows Kits10include10.0.10240.0ucrt" "-IC:Program Files (x86)Windows KitsNETFXSDK4.6.1includeum" "-IC:Program Files (x86)Windows Kits8.1include\shared" "-IC:Program Files (x86)Windows Kits8.1include\um" "-IC:Program Files (x86)Windows Kits8.1include\winrt" /Tcpycocotools/_mask.c /Fobuild emp.win-amd64-3.6Releasepycocotools/_mask.obj
    _mask.c
    e:anaconda3install1libsite-packages umpycoreinclude umpy py_1_7_deprecated_api.h(12) : Warning Msg: Using deprecated NumPy API, disable it by #defining NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION
    pycocotools/_mask.c(3070): warning C4244: “=”: 从“Py_ssize_t”转换到“siz”,可能丢失数据
    pycocotools/_mask.c(3505): warning C4244: “函数”: 从“npy_intp”转换到“siz”,可能丢失数据
    pycocotools/_mask.c(6935): warning C4244: “=”: 从“npy_intp”转换到“siz”,可能丢失数据
    pycocotools/_mask.c(7742): warning C4244: “=”: 从“Py_ssize_t”转换到“siz”,可能丢失数据
    pycocotools/_mask.c(15343): warning C4244: “初始化”: 从“double”转换到“float”,可能丢失数据
    pycocotools/_mask.c(15349): warning C4244: “初始化”: 从“double”转换到“float”,可能丢失数据
    E:Visual Studio 2015installVCBINx86_amd64cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -IE:Anaconda3install1libsite-packages umpycoreinclude -I../common -IE:Anaconda3install1include -IE:Anaconda3install1include "-IE:Visual Studio 2015installVCINCLUDE" "-IE:Visual Studio 2015installVCATLMFCINCLUDE" "-IC:Program Files (x86)Windows Kits10include10.0.10240.0ucrt" "-IC:Program Files (x86)Windows KitsNETFXSDK4.6.1includeum" "-IC:Program Files (x86)Windows Kits8.1include\shared" "-IC:Program Files (x86)Windows Kits8.1include\um" "-IC:Program Files (x86)Windows Kits8.1include\winrt" /Tc../common/maskApi.c /Fobuild emp.win-amd64-3.6Release../common/maskApi.obj
    maskApi.c
    E:Visual Studio 2015installVCBINx86_amd64link.exe /nologo /INCREMENTAL:NO /LTCG /DLL /MANIFEST:EMBED,ID=2 /MANIFESTUAC:NO /LIBPATH:E:Anaconda3install1libs /LIBPATH:E:Anaconda3install1PCbuildamd64 "/LIBPATH:E:Visual Studio 2015installVCLIBamd64" "/LIBPATH:E:Visual Studio 2015installVCATLMFCLIBamd64" "/LIBPATH:C:Program Files (x86)Windows Kits10lib10.0.10240.0ucrtx64" "/LIBPATH:C:Program Files (x86)Windows KitsNETFXSDK4.6.1libumx64" "/LIBPATH:C:Program Files (x86)Windows Kits8.1libwinv6.3umx64" /EXPORT:PyInit__mask build emp.win-amd64-3.6Releasepycocotools/_mask.obj build emp.win-amd64-3.6Release../common/maskApi.obj /OUT:E:TensorflowcocoapiPythonAPIpycocotools\_mask.cp36-win_amd64.pyd /IMPLIB:build emp.win-amd64-3.6Releasepycocotools\_mask.cp36-win_amd64.lib
    _mask.obj : warning LNK4197: 多次指定导出“PyInit__mask”;使用第一个规范
    正在创建库 build emp.win-amd64-3.6Releasepycocotools\_mask.cp36-win_amd64.lib 和对象 build emp.win-amd64-3.6Releasepycocotools\_mask.cp36-win_amd64.exp
    正在生成代码
    已完成代码的生成

    ------------------------------------------------

    然后在命令行输入:python setup.py build_ext install

    -------------------------------------------------

    (E:Anaconda3install1) E:TensorflowcocoapiPythonAPI>python setup.py build_ext install
    running build_ext
    building 'pycocotools._mask' extension
    E:Visual Studio 2015installVCBINx86_amd64cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -IC:UsersluoAppDataRoamingPythonPython36site-packages umpycoreinclude -I../common -IE:Anaconda3install1include -IE:Anaconda3install1include "-IE:Visual Studio 2015installVCINCLUDE" "-IE:Visual Studio 2015installVCATLMFCINCLUDE" "-IC:Program Files (x86)Windows Kits10include10.0.10240.0ucrt" "-IC:Program Files (x86)Windows KitsNETFXSDK4.6.1includeum" "-IC:Program Files (x86)Windows Kits8.1include\shared" "-IC:Program Files (x86)Windows Kits8.1include\um" "-IC:Program Files (x86)Windows Kits8.1include\winrt" /Tcpycocotools/_mask.c /Fobuild emp.win-amd64-3.6Releasepycocotools/_mask.obj
    _mask.c
    c:usersluoappdata oamingpythonpython36site-packages umpycoreinclude umpy py_1_7_deprecated_api.h(12) : Warning Msg: Using deprecated NumPy API, disable it by #defining NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION
    pycocotools/_mask.c(3070): warning C4244: “=”: 从“Py_ssize_t”转换到“siz”,可能丢失数据
    pycocotools/_mask.c(3505): warning C4244: “函数”: 从“npy_intp”转换到“siz”,可能丢失数据
    pycocotools/_mask.c(6935): warning C4244: “=”: 从“npy_intp”转换到“siz”,可能丢失数据
    pycocotools/_mask.c(7742): warning C4244: “=”: 从“Py_ssize_t”转换到“siz”,可能丢失数据
    pycocotools/_mask.c(15343): warning C4244: “初始化”: 从“double”转换到“float”,可能丢失数据
    pycocotools/_mask.c(15349): warning C4244: “初始化”: 从“double”转换到“float”,可能丢失数据
    E:Visual Studio 2015installVCBINx86_amd64cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -IC:UsersluoAppDataRoamingPythonPython36site-packages umpycoreinclude -I../common -IE:Anaconda3install1include -IE:Anaconda3install1include "-IE:Visual Studio 2015installVCINCLUDE" "-IE:Visual Studio 2015installVCATLMFCINCLUDE" "-IC:Program Files (x86)Windows Kits10include10.0.10240.0ucrt" "-IC:Program Files (x86)Windows KitsNETFXSDK4.6.1includeum" "-IC:Program Files (x86)Windows Kits8.1include\shared" "-IC:Program Files (x86)Windows Kits8.1include\um" "-IC:Program Files (x86)Windows Kits8.1include\winrt" /Tc../common/maskApi.c /Fobuild emp.win-amd64-3.6Release../common/maskApi.obj
    maskApi.c
    E:Visual Studio 2015installVCBINx86_amd64link.exe /nologo /INCREMENTAL:NO /LTCG /DLL /MANIFEST:EMBED,ID=2 /MANIFESTUAC:NO /LIBPATH:E:Anaconda3install1libs /LIBPATH:E:Anaconda3install1PCbuildamd64 "/LIBPATH:E:Visual Studio 2015installVCLIBamd64" "/LIBPATH:E:Visual Studio 2015installVCATLMFCLIBamd64" "/LIBPATH:C:Program Files (x86)Windows Kits10lib10.0.10240.0ucrtx64" "/LIBPATH:C:Program Files (x86)Windows KitsNETFXSDK4.6.1libumx64" "/LIBPATH:C:Program Files (x86)Windows Kits8.1libwinv6.3umx64" /EXPORT:PyInit__mask build emp.win-amd64-3.6Releasepycocotools/_mask.obj build emp.win-amd64-3.6Release../common/maskApi.obj /OUT:buildlib.win-amd64-3.6pycocotools\_mask.cp36-win_amd64.pyd /IMPLIB:build emp.win-amd64-3.6Releasepycocotools\_mask.cp36-win_amd64.lib
    _mask.obj : warning LNK4197: 多次指定导出“PyInit__mask”;使用第一个规范
    正在创建库 build emp.win-amd64-3.6Releasepycocotools\_mask.cp36-win_amd64.lib 和对象 build emp.win-amd64-3.6Releasepycocotools\_mask.cp36-win_amd64.exp
    正在生成代码
    已完成代码的生成
    running install
    running build
    running build_py
    running install_lib
    copying buildlib.win-amd64-3.6pycocotools\_mask.cp36-win_amd64.pyd -> E:Anaconda3install1Libsite-packagespycocotools
    running install_egg_info
    Writing E:Anaconda3install1Libsite-packagespycocotools-2.0-py3.6.egg-info

    -------------------------------------------------

    安装编译完成

    ④在命令行切换到Mask_RCNN目录下的   samples目录

    然后你命令行输入:jupyter notebook   

    也可以直接在开始菜单打开Jupyter Notebook,

    ⑤然后会发现该衬托关系打开了默认浏览器,并且打开新的页面,内容如下:

    ⑥然后点击  demo.ipynb,进入新页面

    这是发现改程序有默认的一次运行结果,但这不影响我们后面的操作,

    ⑦在顶部菜单栏中选择   Cell —>  Run All

    ⑧注意查看下面有没有报错,如果没有报错,等待运行结果,一般报错位置在此处,可能会提示你更新numpty,此时只需要 pip install numpty,numpty会自动更新到新版本

    ⑨运行成功以后会出现类似第六步的效果图

    ⑩如果想运行自己的图片,只要打开  Mask_RCNN目录下的images目录,看到里面就有刚才运行的效果原图,可以把这些图片全部删掉,把自己的图片拷贝进去,不用修改图片名称,因为Mask_RCNN程序会自动遍历该目录下的图片,然后随机选取一张图片运行。

  • 相关阅读:
    Codeforces Round #313 (Div. 1) A.Gerald's Hexagon
    COJN 0585 800604鸡蛋的硬度
    COJN 0584 800603吃糖果
    COJN 0583 800602分苹果
    COJN 0575 800601滑雪
    昨天的补记
    重构的代码
    写了一个复杂的sql语句
    一个想法
    安装了C
  • 原文地址:https://www.cnblogs.com/herd/p/9489902.html
Copyright © 2011-2022 走看看