尝试使用 ImageAI 创建对象检测程序。 ImageAI 文档上有 detectObjectsFromImage 命令,但是当我尝试使用它时
AttributeError: 'VideoObjectDetection' object has no attribute 'detectObjectsFromImage'
代码:
from imageai.Detection import VideoObjectDetection
UAVImages = os.listdir("UAV")
randomFile = UAVImages[random.randint(0, len(UAVImages) - 1)]
detectedImage, detections = detector.detectObjectsFromImage(output_type="array", input_image="UAV/{0}".format(randomFile), minimum_percentage_probability=30)
convertedImage = cv.cvtColor(detectedImage, cv.COLOR_RGB2BGR)
showImage(convertedImage)
for eachObject in detections:
print(eachObject["name"] , " : ", eachObject["percentage_probability"], " : ", eachObject["box_points"] )
print("--------------------------------")