Я использую предварительно обученную модель для обнаружения объектов, так как я получаю выше error tensorflow version = 2.2.0 keras version = 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("--------------------------------")