我正在尝试使用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.png test2_new.png
我也尝试过使用FasterRcnn和RetinaNet解决此问题,并且得到相同的结果。
请帮助我解决此问题。 谢谢, 斯里尼