分类
技术

使用Imageai的安装过程

Imageai项目github地址:https://github.com/OlafenwaMoses/ImageAI

使用Imageai的安装过程

1、安装Python3.6环境 建议3.6 库非常多,太新了库对应的第三方库不好找

2、安装以下imageai依赖的插件,详细见中文教程:https://imageai-cn.readthedocs.io/zh_CN/latest/index.html

Numpy 1.13.1(及更高版本) 安装或 通过pip安装
pip3 install numpy

SciPy 0.19.1(及更高版本) 安装或 通过pip安装
pip3 install scipy

OpenCV 安装或 通过pip安装
pip3 install opencv-python

pillow 安装或 通过pip安装
pip3 install pillow

Matplotlib 安装或 通过pip安装
pip3 install matplotlib

h5py 安装或 通过pip安装
pip3 install h5py

Keras 2.x 安装或 通过pip安装
pip3 install keras

3、安装tensorflow_gpu-1.15.2-cp36-cp36m-win_amd64.whl(版本要和Python3.6对应,如果要训练,需要安装gpu版本),目前imageai不支持tensorflow2.0以上

4、安装ImageAI:
pip3 install imageai-2.1.5-py3-none-any.whl

5、安装二维码库,项目有使用到,没有的可以不装:
pip install pyzbar
yum install zbar

以上可以开发代码了

以下是自定义使用模型检测


6、如果要本机做训练图片的model,需要安装。需要去英伟达官方下载其中cudnn还需要注册用户才能下载
1)cuda_10.0.130_411.31_win10.exe
win10 一定要安装cuda10.0版本,不然imagai训练的时候会找不到dll。

2)cudnn-10.2-windows10-x64-v7.6.5.32.zip
解压下,里面的三个文件夹拷贝到C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.0目录合并

7、训练的py脚本:
from PIL import ImageFile
ImageFile.LOAD_TRUNCATED_IMAGES = True
from imageai.Prediction.Custom import ModelTraining
model_trainer = ModelTraining()
model_trainer.setModelTypeAsResNet()
model_trainer.setDataDirectory(“ps”)
model_trainer.trainModel(num_objects=5, num_experiments=50, enhance_data=True, batch_size=5, show_network_summary=True)

使用说明详细见:https://github.com/OlafenwaMoses/ImageAI/blob/master/imageai/Prediction/CUSTOMTRAINING.md

8、ai应用开发详细见github或者中文网,imageai支持动态视频检测
Imageai项目github地址:https://github.com/OlafenwaMoses/ImageAI
中文开发文档:https://imageai-cn.readthedocs.io/zh_CN/latest/index.html

发表评论