我正在使用预训练模型来检测物体,因为我遇到了以上错误 张量流版本= 2.2.0 keras版本= 2.3.1
下面是我的代码
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.1.h5"))
detector.loadModel()
custom_objects = detector.CustomObjects(person=True, car=False)
detections = detector.detectCustomObjectsFromImage(input_image=os.path.join(execution_path ,"image.jpg"),output_image_path=os.path.join(execution_path , "image_new.jpg"), custom_objects=custom_objects, minimum_percentage_probability=65)
for eachObject in detections:
print(eachObject["name"] + " : " + eachObject["percentage_probability"] )
print("--------------------------------")