MacOS上的Tensorflow模型格式问题

时间:2018-11-13 20:19:39

标签: macos tensorflow python-3.6

我正在尝试在https://towardsdatascience.com/object-detection-with-10-lines-of-code-d6cb4d86f606中找到imageai的示例:

from imageai.Detection import ObjectDetection
import os

execution_path = os.getcwd()

detector = ObjectDetection()
detector.setModelTypeAsRetinaNet()
detector.setModelPath( os.path.join(execution_path , "resnet50_coco_best_v2.0.3.h5"))
detector.loadModel()
detections = detector.detectObjectsFromImage(input_image=os.path.join(execution_path , "image.jpg"), output_image_path=os.path.join(execution_path , "imagenew.jpg"))

for eachObject in detections:
    print(eachObject["name"] , " : " , eachObject["percentage_probability"] )

但是,我遇到此错误:

TypeError: Expected int32, got list containing Tensors of type '_Message' instead.

是什么原因引起的?如此处建议的那样,imageai是否与最新的Tensorflow版本不兼容:Tensorflow Slim: TypeError: Expected int32, got list containing Tensors of type '_Message' instead

如果是这样,我该怎么做才能使其在此图像示例中正常工作?

编辑:我检查了一下,这在带有Python 3.6的Windows上有效

0 个答案:

没有答案