20 行代码:Serverless 架构下用 Python 轻松搞定图像分类和预测

20 行代码:Serverless 架构下用 Python 轻松搞定图像分类和预测
复制# -*- coding: utf-8 -*-  from imageai.Prediction import ImagePrediction  # 模型加载  prediction = ImagePrediction()  prediction.setModelTypeAsResNet()  prediction.setModelPath("resnet50_weights_tf_dim_ordering_tf_kernels.h5")  prediction.loadModel()  predictions,行代像分 probabilities = prediction.predictImage("./picture.jpg", result_count=5 )  for eachPrediction, eachProbability in zip(predictions, probabilities):      print(str(eachPrediction) + " : " + str(eachProbability))  1.2.3.4.5.6.7.8.9.10.11.12.
滇ICP备2023000592号-31