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

Doubts with inference #5

Open
txusser opened this issue Jul 14, 2021 · 0 comments
Open

Doubts with inference #5

txusser opened this issue Jul 14, 2021 · 0 comments

Comments

@txusser
Copy link

txusser commented Jul 14, 2021

Hi enochkan,

Thank you very much for sharing the code, it is a great resource for us coming from plain image analysis into DL. This is not properly an issue but:

I have trained your net using Nifti-1 images. I modified your code so it accepts Nifti as an input instead of hf5. My input data are 3D DATSPECT images of 128x128x128.

After the training, I am trying to perform inference using the saved generator_n.pth. I have written the following code:

generator = GeneratorUNet()
generator.load_state_dict(torch.load(opt.model_pth))
generator.eval().cuda(device=0)

img = nib.load(opt.in_path)
img_data = img.get_fdata()
tensor_arr = torch.tensor(img_data)

output = generator(tensor_arr).data.cpu().numpy()

Nevertheless, this code seems to fail with the following error:

RuntimeError: Expected 5-dimensional input for 5-dimensional weight [64, 1, 4, 4, 4], but got 3-dimensional input of size [128, 128, 128] instead

Is there something I am missing?

@txusser txusser changed the title Other tasks rather than reconstruction Doubts with inference Jul 19, 2021
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

1 participant