TypeError in transforms notebook
See original GitHub issueHi all,
I’m trying to run the integrate_3rd_party_transforms
notebook on Google Colab, but it’s not working. First, there’s no line to install MONAI. Second, once installed, I get this error when trying to run the last cell:
TypeError Traceback (most recent call last)
<ipython-input-15-dfd10a517436> in <module>()
2 check_loader = monai.data.DataLoader(check_ds, batch_size=1)
3 check_data = monai.utils.misc.first(check_loader)
----> 4 image, label = (check_data['image'][0][0], check_data['label'][0][0])
5 print(f"image shape: {image.shape}, label shape: {label.shape}")
6 # plot the slice [:, :, 80]
TypeError: 'NoneType' object is not subscriptable
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Torchvision transforms.toPILImage() TypeError: function takes ...
The error comes when transform RandomRotation is invoked and a new instance of Image class is created. Particularly, function core.fill() at ...
Read more >v0.6.5 TypeError: apply_transform() got an unexpected ...
Hi, I'm using a Colab notebook and since today I was unable to start the code, even though nothing changed. The logged message...
Read more >Simple Example - | notebook.community
Image Preprocessing transform = transforms. ... RandomHorizontalFlip(), transforms. ... TypeError: 'NoneType' object cannot be interpreted as an integer ...
Read more >ImageDataBunch.from_df throws when adding transforms tfms ...
In two words, when I add transforms to ImageDataBunch it throws. Same code without transforms works just fine TypeError Traceback (most ...
Read more >Bug on torchvision.transforms.functional.resize?
'''TypeError: img should be PIL Image. Got <class 'torch.Tensor'>'''. Both notebook running the same version of torchvision 0.7.0.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hi @fepegar ,
We may try to move all notebooks to Colab later, and update to use DecathlonDataset. Because we want to do a new refactoring iteration for datasets to support cross-validation soon, so I haven’t changed notebooks.
Thanks.
Hi @Nic-Ma,
Oh, sorry. I see now that the path to the data was local. I thought the notebook would be self-contained. I think it would be nice that
It does, it was added in https://github.com/fepegar/torchio/commit/19ff6e7568ab2c62e579fd0728571760d3e381c4 and it’s available in
v0.17.21
(you can try running the code I shared in https://github.com/Project-MONAI/MONAI/issues/851#issuecomment-669139528). I haven’t added support in the transforms mentioned in the commit, message, but it should be fine for most of them.If the input is a
dict
, akeys
kwarg must be passed. The values of those keys are expected to be 4D tensors with shape (C, D, H, W). I can adapt them further if that would be helpful.