-
Notifications
You must be signed in to change notification settings - Fork 240
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
How to structure torchio.Subject for regression? #297
Comments
Hi torchio/torchio/data/subject.py Line 8 in 08af12b
it gives an example where subject age in added at the init call so you just need to add a key to subject_dict, ... is that what you are looking for ? |
@sarthakpati have you tried what @romainVala has suggested? Here's some code that might help: In [10]: import torchio as tio
In [11]: subjects = [tio.Subject(t1=tio.ScalarImage('t1.nii.gz'), age=30+i) for i in range(5)]
In [12]: dataset = tio.SubjectsDataset(subjects)
In [13]: loader = DataLoader(dataset, batch_size=2, shuffle=True)
In [14]: for batch in loader:
...: print(batch['age'])
...:
tensor([31, 33])
tensor([30, 32])
tensor([34]) Where the |
Hey, sorry I forgot to reply. Yes, I was able to get it working using @romainVala's suggestion. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi,
I am trying to use TorchIO for regression and I was wondering if there is any way to add the "value to predict" per subject and get it during the training cycle?
Here is what I have (for segmentation):
Cheers,
Sarthak
The text was updated successfully, but these errors were encountered: