Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RSSegBenchmark-c2fnet复现出现bug #64274

Open
famersalltheday opened this issue May 14, 2024 · 12 comments
Open

RSSegBenchmark-c2fnet复现出现bug #64274

famersalltheday opened this issue May 14, 2024 · 12 comments
Assignees

Comments

@famersalltheday
Copy link

bug描述 Describe the Bug

'''NotImplementedError: (Unimplemented) Invalid dimension to be accessed. Now only supports access to dimension 0 to 9, but received dimension is 10. (at C:\home\workspace\Paddle_release\paddle/phi/core/ddim.h:53)
[operator < split > error]'''

我在复现C2FNet模块的时候,出现了上述bug,我曾见其他人员提出过这个问题,但是它依然存在。我严格按照官方指定的环境进行测试,出现了这个bug。我升级各种版本的paddlepaddle,但是bug依然存在,希望可以得到帮助解决,谢谢。

其他补充信息 Additional Supplementary Information

No response

@DesmonDay
Copy link
Contributor

有没有什么简单的复现例子,我这边复现一下。看起来是你输入的tensor维度过多了。

@famersalltheday
Copy link
Author

https://github.com/PaddlePaddle/PaddleSeg/blob/release/2.9/contrib/RSSegBenchmark/c2fnet/README.md
我完全复现的PaddleSeg的案例,数据集和环境都是一致的。
我这个bug也有很多人遇到过,但是不知道从何处解决。

@DesmonDay
Copy link
Contributor

建议从代码里面深入看为什么会出现这个问题吧

@Bobholamovic
Copy link
Member

你好,请提供更完整的报错信息,以帮助我们排查问题~

@famersalltheday
Copy link
Author

你好,请提供更完整的报错信息,以帮助我们排查问题~

你好,
这个就是完整的报错信息。

'''NotImplementedError: (Unimplemented) Invalid dimension to be accessed. Now only supports access to dimension 0 to 9, but received dimension is 10. (at C:\home\workspace\Paddle_release\paddle/phi/core/ddim.h:53)
[operator < split > error]'''

我严格按照官方配置和环境运行的,
https://github.com/PaddlePaddle/PaddleSeg/blob/release/2.9/contrib/RSSegBenchmark/c2fnet/README.md

@Bobholamovic
Copy link
Member

这看起来只是错误信息的最后一段,请提供包括Python栈回溯信息在内的完整错误信息~

@famersalltheday
Copy link
Author

这看起来只是错误信息的最后一段,请提供包括Python栈回溯信息在内的完整错误信息~

Traceback (most recent call last):
File "train.py", line 269, in
main(args)
File "train.py", line 264, in main
to_static_training=cfg.to_static_training)
File "E:\PaddleSeg-develop\contrib\RSSegBenchmark\c2fnet\core\train.py", line 309, in train
**test_config)
File "E:\PaddleSeg-develop\contrib\RSSegBenchmark\c2fnet\core\val.py", line 169, in evaluate
crop_size=crop_size)
File "E:\PaddleSeg-develop\contrib\RSSegBenchmark\c2fnet\core\infer.py", line 190, in fined_inference
logits = model(im, heatmap)
File "D:\anaconda3\envs\segmentation\lib\site-packages\paddle\fluid\dygraph\layers.py", line 930, in call
return self._dygraph_call_func(*inputs, **kwargs)
File "D:\anaconda3\envs\segmentation\lib\site-packages\paddle\fluid\dygraph\layers.py", line 915, in _dygraph_call_func
outputs = self.forward(*inputs, **kwargs)
File "E:\PaddleSeg-develop\contrib\RSSegBenchmark\c2fnet\models\c2fnet.py", line 261, in forward
axis=1)
File "D:\anaconda3\envs\segmentation\lib\site-packages\paddle\tensor\manipulation.py", line 955, in split
input=x, num_or_sections=num_or_sections, dim=axis, name=name)
File "D:\anaconda3\envs\segmentation\lib\site-packages\paddle\fluid\layers\nn.py", line 5097, in split
_C_ops.split(input, out, *attrs)
NotImplementedError: (Unimplemented) Invalid dimension to be accessed. Now only supports access to dimension 0 to 9, but received dimension is 10. (at C:\home\workspace\Paddle_release\paddle/phi/core/ddim.h:53)
[operator < split > error]

你好,上述是全面的报错信息。

@Bobholamovic
Copy link
Member

Bobholamovic commented May 21, 2024

RSSegBenchmark通过测试的最新版本是PaddlePaddle 2.4+PaddleSeg 2.8,而从报错信息来看,实际使用的代码应该是PaddleSeg-develop,开发分支的代码尚未经过测试,因此可能存在bug。建议在装有PaddlePaddle 2.4+PaddleSeg 2.8的环境中再次尝试~

@famersalltheday
Copy link
Author

你好,我尝试了替换环境为paddlepaddle==2.4.0 PaddleSeg==2.8.0, 依然报告相同的错误,:
Traceback (most recent call last):
File "train.py", line 269, in
main(args)
File "train.py", line 264, in main
to_static_training=cfg.to_static_training)
File "E:\PaddleSeg-develop\contrib\RSSegBenchmark\c2fnet\core\train.py", line 309, in train
**test_config)
File "E:\PaddleSeg-develop\contrib\RSSegBenchmark\c2fnet\core\val.py", line 169, in evaluate
crop_size=crop_size)
File "E:\PaddleSeg-develop\contrib\RSSegBenchmark\c2fnet\core\infer.py", line 190, in fined_inference
logits = model(im, heatmap)
File "D:\anaconda3\envs\segmentation\lib\site-packages\paddle\fluid\dygraph\layers.py", line 948, in call
return self.forward(*inputs, **kwargs)
File "E:\PaddleSeg-develop\contrib\RSSegBenchmark\c2fnet\models\c2fnet.py", line 261, in forward
axis=1)
File "D:\anaconda3\envs\segmentation\lib\site-packages\paddle\tensor\manipulation.py", line 1982, in split
return _C_ops.split(input, num_or_sections, dim)
NotImplementedError: (Unimplemented) Invalid dimension to be accessed. Now only supports access to dimension 0 to 9, but received dimension is 10. (at C:\home\workspace\Paddle\paddle/phi/core/ddim.h:53)

@Bobholamovic
Copy link
Member

Bobholamovic commented May 23, 2024

看起来代码并没有被更换到PaddleSeg 2.8.0。

实际上,PaddleSeg 2.8.0的contrib\RSSegBenchmark\c2fnet\models\c2fnet.py的第261行是这样的:

https://github.com/PaddlePaddle/PaddleSeg/blob/a485168da281e942af7d1643aa726d44df8c9951/contrib/RSSegBenchmark/c2fnet/models/c2fnet.py#L261

而PaddleSeg-develop的对应行是这样的:

https://github.com/PaddlePaddle/PaddleSeg/blob/7c07b1d49aeeb10b6d6f0aa244aab4171ab2709c/contrib/RSSegBenchmark/c2fnet/models/c2fnet.py#L261

使用PaddleSeg develop的代码才可能得到这样的错误信息:

File "E:\PaddleSeg-develop\contrib\RSSegBenchmark\c2fnet\models\c2fnet.py", line 261, in forward
axis=1)

因此,你使用的很可能还是PaddleSeg develop的代码。请更换PaddleSeg 2.8后尝试~

请注意,你应该从GitHub或Gitee等代码托管网站下载PaddleSeg 2.8的完整代码,使用其中的contrib\RSSegBenchmark子项目,而不只是通过pip等工具安装paddleseg库~

@famersalltheday
Copy link
Author

famersalltheday commented May 25, 2024

File "E:\Segmentation\PaddleSeg-release-2.8\contrib\RSSegBenchmark\c2fnet\core\train.py", line 309, in train
**test_config)
File "E:\Segmentation\PaddleSeg-release-2.8\contrib\RSSegBenchmark\c2fnet\core\val.py", line 169, in evaluate
crop_size=crop_size)
File "E:\Segmentation\PaddleSeg-release-2.8\contrib\RSSegBenchmark\c2fnet\core\infer.py", line 190, in fined_inference
logits = model(im, heatmap)
File "D:\anaconda3\envs\segmentation\lib\site-packages\paddle\fluid\dygraph\layers.py", line 948, in call
return self.forward(*inputs, **kwargs)
File "E:\Segmentation\PaddleSeg-release-2.8\contrib\RSSegBenchmark\c2fnet\models\c2fnet.py", line 270, in forward
axis=1)
File "D:\anaconda3\envs\segmentation\lib\site-packages\paddle\tensor\manipulation.py", line 1982, in split
return _C_ops.split(input, num_or_sections, dim)
NotImplementedError: (Unimplemented) Invalid dimension to be accessed. Now only supports access to dimension 0 to 9, but received dimension is 10. (at C:\home\workspace\Paddle\paddle/phi/core/ddim.h:53)

你好,我已经按照您的指示,重新下载了PaddleSeg 2.8,不是pip安装的。
测试报错如下,报错内容一样,只是错误信息所在的行数发生了变化

我想补充强调的是代码可以训练,但是在保存权重的时候 报错这个问题

@Bobholamovic
Copy link
Member

Bobholamovic commented May 27, 2024

我想补充强调的是代码可以训练,但是在保存权重的时候 报错这个问题

我读了一下代码,这个分支是推理阶段(self.training为False)才执行的,所以这一现象是符合预期的。

关于这个错误,我实验发现有可能在num_or_sections列表元素之和与输入tensor在指定axis的尺寸不一致时触发,对于我们的情况而言,也就是说selected_fea_regions的第1维尺寸可能不是16(结合上下文来看,也就是说,设置的类别数可能不是16)。建议在E:\Segmentation\PaddleSeg-release-2.8\contrib\RSSegBenchmark\c2fnet\models\c2fnet.py的第267行执行print(selected_fea_regions.shape)检查tensor的尺寸是否符合预期。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants