PaddleSeg icon indicating copy to clipboard operation
PaddleSeg copied to clipboard

PP-HumanSeg: IndexError: too many indices for array: array is 3-dimensional, but 4 were indexed

Open andy315 opened this issue 1 year ago • 5 comments

问题确认 Search before asking

Bug描述 Describe the Bug

训练微调之后得到的model(human_pp_humansegv2_lite), 运行推理的时候报错: Traceback (most recent call last): File "C:\Python38\lib\tkinter_init_.py", line 1892, in call return self.func(*args) File "C:\Python38\lib\tkinter_init_.py", line 814, in callit func(*args) File ".\src\test.py", line 125, in main out = predictor.run(bgr_image, bg) File "D:\Workplace\PaddleSeg\contrib\PP-HumanSeg\src\infer.py", line 122, in run return self.postprocess(output, img, data, bg) File "D:\Workplace\PaddleSeg\contrib\PP-HumanSeg\src\infer.py", line 126, in postprocess score_map = pred_img[0, 1, :, :] IndexError: too many indices for array: array is 3-dimensional, but 4 were indexed

复现环境 Environment

-OS: windows -PaddlePaddle: 2.6.0 -PaddleSeg: release/2.9 -python: 3.8.10 -Cuda: 11.8 -cudnn: 8.9.7

Bug描述确认 Bug description confirmation

  • [X] 我确认已经提供了Bug复现步骤、代码改动说明、以及环境信息,确认问题是可以复现的。I confirm that the bug replication steps, code change instructions, and environment information have been provided, and the problem can be reproduced.

是否愿意提交PR? Are you willing to submit a PR?

  • [X] 我愿意提交PR!I'd like to help by submitting a PR!

andy315 avatar Jan 26 '24 08:01 andy315

export 的时候带上output_op参数(试了softmax)没有问题。default 是argmax,难道这个有问题?

andy315 avatar Jan 30 '24 05:01 andy315

看上去是预测图像中的问题,我们会尽快确认排除。

shiyutang avatar Feb 05 '24 11:02 shiyutang

export 的时候带上output_op参数(试了softmax)没有问题。default 是argmax,难道这个有问题?

我用提供的推理模型测试好像是没问题的

chenjjcccc avatar Feb 06 '24 02:02 chenjjcccc

@andy315 我 也遇到了相似的问题 ,如果是用download_pretrained_models.py 这个代码下载下来的模型是能用的,但是简介里提供的其他模型是用不了的。不知为何 请问你知道问题出在哪里不?

tongchangD avatar Mar 25 '24 09:03 tongchangD

突然发现是自己蠢了,提供了 argmax 和 softmax的 ,我不该用softmax的代码 argmax的模型

tongchangD avatar Mar 25 '24 09:03 tongchangD