Dictionary-based transformation for same transforms on images and labels #2827
-
Hello @Nic-Ma, I hope you well.
When i run it, i get this results ( first and second slice of MRI and label showed): and when run show code again i get this: I have 2 questions: |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 15 replies
-
Hi, every time you access an element in the dataset, the transforms will be randomised. Hence, in this code snippet: img = train_dataset[sample_num]['image'].squeeze(0)
lbl = train_dataset[sample_num]['label'].squeeze(0) there is a different random state between the data = train_dataset[sample_num]
img = data['image'].squeeze(0)
lbl = data['label'].squeeze(0) this will hopefully sort your problem. |
Beta Was this translation helpful? Give feedback.
Hi, every time you access an element in the dataset, the transforms will be randomised. Hence, in this code snippet:
there is a different random state between the
img
andlbl
, and therefore different transforms are applied to them. If you instead do:this will hopefully sort your problem.