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
AttributeError: 'dict' object has no attribute 'to' #844
Comments
Hi @carlpe , I think you should move the |
Hi @ericspod , could you please help take a look this issue? Thanks. |
The discriminator's |
Hi Eric, thanks for reply. I am not sure I understand everything yet. But does it make sense that because the inputs are 3D images with 400,400,400, I would need more to get it to work? I assume that Discriminator in-shape should be 1,400,400 and start_shape 1,50,50 for the Generator. Given that I keep strides [2, 2, 2, 1]. I did try to run this with 1,400,400 and 1,50,50 .. and I got a new error: RuntimeError: Expected 4-dimensional input for 4-dimensional weight [8, 1, 5, 5], but got 5-dimensional input of size [1, 1, 1, 64, 64] instead. |
If you have 3D inputs the discriminator and generator need to be given 3D sizes. The |
Good. I will try it tomorrow. Thanks 👍 |
I did manage to get around that error now. Using 1,400,400,400 and 1,50,50,50 However, it is too demanding for video memory. How would I proceed if I wanted to preprocess the images to smaller sizes before I ship them in? RuntimeError: CUDA out of memory. Tried to allocate 74.51 GiB (GPU 0; 23.65 GiB total capacity; 2.67 MiB already allocated; 22.79 GiB free; 4.00 MiB reserved in total by PyTorch) |
So, I resized all inputs to 64,64,64 - and now everything seems to be working. Although I wish there was some way to do this with the original size.,. Thanks for help |
Memory is often a challenge with 3D inputs, if you can't fit a batch of 1 into memory the alternative is to train on patches. One workflow is https://github.com/Project-MONAI/MONAI/blob/master/examples/workflows/unet_training_dict.py which uses |
Would that work with GAN also? |
Depends on the exact GAN configuration you're using. If you train the discriminator on patches I could see it learning to tell real from synthetic effectively, but a generator would have a hard time learning how to create a coherent image patch-wise. |
Yes, I see... I will try to find a balanced size that fits into memory for now I think.. |
I think this is from from the |
Trying to run MednistGAN tutorial on some own nifti files.
Images (dict) are loaded and transformed as expected. When I attempt to train, I get an error:
AttributeError: 'dict' object has no attribute 'to'
The text was updated successfully, but these errors were encountered: