当人员站在CLO时检测人员的问题

2024-04-19 09:27:09 发布

您现在位置:Python中文网/ 问答频道 /正文

我尝试使用Python和ImageAI-test2.png检测图像中的人数,并使用以下代码:

from imageai.Detection import ObjectDetection
detector = ObjectDetection()
model_path = "yolo.h5"
input_path = 'test2.png'
output_path = "test2_new.png"
detector.setModelTypeAsYOLOv3()
detector.setModelPath(model_path)
detector.loadModel()
custom_objects=detector.CustomObjects(person=True)
detection = detector.detectCustomObjectsFromImage(custom_objects=custom_objects,     input_image=input_path, output_image_path=output_path, minimum_percentage_probability=20,display_percentage_probability=False,display_object_name=False)

for eachItem in detection:
    print(eachItem["name"] , " : ", eachItem["percentage_probability"])

尽管我们在该图像中有9个人,但上面的代码只识别了7个人(请参考test2_new.png)。当人们站得很近(或一个接一个)时,我也会遇到类似的问题。 test2.pngtest2_new.png

我也试着用FasterRCnn和RetinaNet解决这个问题,我得到了同样的结果

请帮我解决这个问题。 谢谢 斯里尼


Tags: path代码图像newinputoutputobjectspng