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

size of input会随着batchsize的改变而改变 #51

Open
yuijn456 opened this issue Mar 3, 2023 · 3 comments
Open

size of input会随着batchsize的改变而改变 #51

yuijn456 opened this issue Mar 3, 2023 · 3 comments

Comments

@yuijn456
Copy link

yuijn456 commented Mar 3, 2023

使用3d unet,用的brats2020的数据集,python main.py后,targetsize和inputsize会出现维度不匹配的问题,inputsize是[(2,2,32,32,32)],targetsize是[(2,64,32,32)];我把target.reshape([2,2,32,32,32])后成功运行,但是后续调整batsize的的大小,程序又会报错,RuntimeError: shape '[2, 2, 32, 32, 32]' is invalid for input of size 524288,就是inputsize会随着batchsize的改变而改变,这是什么原因呢,因为一般batchsize不就是可以随意改变的吗

@smallkaka
Copy link

我也是相同问题,这份代码类似的loss设置,我在https://github.com/HiLab-git/SSL4MIS见过。但是我的问题没有解决,我暂时放弃这份代码了

@smallkaka
Copy link

smallkaka commented Mar 6, 2023

loss = criterion_ce(outputs, y) + criterion_dice(outputs, y.argmax(dim=1).unsqueeze(1))
我尝试这样修改,可以跑通,你可以试试,欢迎交流结果

@yuijn456
Copy link
Author

谢谢您的解决方案,我现在也能跑通了,只不过各项指标不太理想。

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

No branches or pull requests

2 participants