我正在尝试遵循 [this tutorial][1] 并且我正在使用 Python 3.7。这是我的代码:
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.1.0.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"] )
但唯一出现的是:'UnboundLocalError: local variable 'retval_' referenced before assignment' 有什么帮助吗?[1]:https ://towardsdatascience.com/object-detection-with-10-lines-of-code-d6cb4d86f606