随着深度学习算法的兴起和普及,人工智能领域取得了令人瞩目的进步,特别是在计算机视觉领域。21世纪的第二个十年迅速采用卷积神经网络,发明了最先进的算法,大量训练数据的可用性以及高性能和高性价比计算的发明。计算机视觉中的一个关键概念是图像分类; 这是软件系统正确标记图像中主导对象的能力。
    ImageAI是一个Python库,旨在帮助开发人员构建具有自包含计算机视觉功能的应用程序和系统。
    1. 安装Python 3.5.1或更高版本和pip
    (如果您已经安装了Python 3.5.1或更高版本,请跳过本节)
    #/downloads/
    2. 安装ImageAI依赖项
    - Tensorflow
    pip3 install --upgrade tensorflow
    - Numpy
    pip3 install numpy
    - SciPy
    pip3 install scipy
    - OpenCV
    pip3 install opencv-python
    - Matplotlib
	    pip3 install matplotlib
	
    - h5py
    pip3 install h5py
    - Keras
    pip3 install keras
    3. 安装ImageAI库
    pip3 install https://github.com/OlafenwaMoses/ImageAI/raw/master/dist/imageai-1.0.2-py3-none-any.whl
    4. 下载经过ImageNet-1000数据集训练的ResNet Model文件,并将文件复制到您的python项目文件夹。
    https://github.com/fchollet/deep-learning-models/releases/download/v0.2/resnet50_weights_tf_dim_ordering_tf_kernels.h5
    5. 创建一个名称为python的文件(例如“FirstPrediction.py”),并将下面的代码写入其中。
    from imageai.Prediction import ImagePrediction
    import os
    execution_path = os.getcwd()
    prediction = ImagePrediction()
    prediction.setModelTypeAsResNet()
    prediction.setModelPath( execution_path + “ esnet50_weights_tf_dim_ordering_tf_kernels.h5”)
    prediction.loadModel()
    predictions, percentage_probabilities = prediction.predictImage(“C:UsersMyUserDownloadssample.jpg”, result_count=5)
    for index in range(len(predictions)):
	    print(predictions[index] + “ : ” + percentage_probabilities[index])
	更多潍坊平面设计培训相关资讯,请扫描下方二维码