使用Tensorflow从0开始搭建精灵宝可梦的检测APP
本文为本人原创,转载请注明来源链接
环境要求
Tensorflow1.12.0
cuda 9.0
python3.6.10
Android Studio
Anaconda
安装Tensorflow
使用conda 安装GPU版Tensorflow
conda install tensorflow-gpu=1.12.0
找到tensorflow的安装位置
我的位置在: home/jiading/.conda/envs/tensorflow12/lib/python3.6/site-packages/tensorflow
通过conda安装的tensorflow是不包括models这一模块的,需要从Github上下载: https://github.com/tensorflow/models
将它克隆到tensorflow文件夹下:
打开models\research\object_detection,按照https://github.com/tensorflow/models/blob/master/research/object_detection/g3doc/installation.md提示的进行安装
运行 python object_detection/builders/model_builder_test.py 测试是否安装成功
下载和处理数据集
我们采用的数据集是https://www.kaggle.com/lantian773030/pokemonclassification。如果你使用colab训练,可以直接将数据集下载到colab中: https://blog.csdn.net/qq_35654046/article/details/87621396
原始的数据集只有图像和类别,可以用于分类,但是用于目标检测的话需要在此基础上进一步标定数据,在图像中框出神奇宝贝的位置。
这里我们使用labelme这个软件进行标定。labelme可以直接通过pip安装: pip install labelme -i https://pypi.tuna.tsinghua.edu.cn/simp le
在终端(Bash和Windows的Powershell都可以)中直接输出Labelme即可打开软件.labelme的简单教程可以看这里: https://www.cnblogs.com/wangxiaocvpr/p/9997690.html
标定数据后,我们在各个神奇宝贝的文件夹中得到了和原图像同名的 Json 文件: