PaddlePaddle / PaddleDetection

Object Detection toolkit based on PaddlePaddle. It supports object detection, instance segmentation, multiple object tracking and real-time multi-person keypoint detection.
Apache License 2.0
12.82k stars 2.89k forks source link

[求助] 使用 infer 预测时,目标总数不能超过100 #1341

Closed Fauny closed 4 years ago

Fauny commented 4 years ago

AiStudio环境

参考大佬【更快更强! 高效快速的PP-YOLO实战演练】学习 pp-yolo 训练自定义数据集(单一类别)

训练模型后,使用 infer.py 预测,发现目标数量大于100的图片,只能显示最多100个结果

请教如何预测超过100个目标的图片?

willthefrog commented 4 years ago

修改 keep_top_k

MatrixNMS:
    background_label: -1
    keep_top_k: 100
    normalized: false
    score_threshold: 0.01
    post_threshold: 0.01
Fauny commented 4 years ago

@willthefrog 谢谢回复!

加到了500,没有起作用。

是需要在训练模型时就要设定吗?

willthefrog commented 4 years ago

不需要,可以尝试调低 post_thresholdscore_threshold

Fauny commented 4 years ago

@willthefrog 再次感谢

找到了这个:https://github.com/PaddlePaddle/Paddle/blob/develop/python/paddle/fluid/layers/detection.py 有一段说明:

nms_top_k(int): Maximum number of detections to be kept according
       to the confidences after filtering detections based on
       score_threshold and before NMS. Default: 400. 
keep_top_k(int): Number of total bboxes to be kept per image after
       NMS step. -1 means keeping all bboxes after NMS step. Default: 200.

该成这样了:

MatrixNMS:
    background_label: -1
    nms_top_k: 800
    keep_top_k: 800
    normalized: false
    score_threshold: 0.001
    post_threshold: 0.001

测试代码:

 python -u tools/infer.py -c ../ppyolo.yml --infer_img=../test2/1.jpeg --output_dir=../test_res --draw_threshold=0.01  -o weights=output/ppyolo/best_model

还是不灵,就只能100个,最小的score是0.91

Fauny commented 4 years ago

那位大佬能帮忙解答啊,着急..

有没有同样需求的,怎么解决?

willthefrog commented 4 years ago

发现完整配置及输出吧

Fauny commented 4 years ago

@willthefrog 解决了

下了最新代码,装备尝试,发现参数改的不是infer用的文件,【狂汗】