-
Notifications
You must be signed in to change notification settings - Fork 7k
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
No support for multi-channel images #882
Comments
I agree that is indeed a common problem in remote sensing, especially hyperspectral imaging. |
I would love for this to be a focus. Not only is it a problem for multi-channel data, but also it causes issue for target transformations for semantic segmentation where a channel is needed for each target. |
@jphdotam we are going to be following a slightly different approach for semantic segmentation, where we will be using torch operations to perform the transformations. See https://github.com/pytorch/vision/blob/master/references/segmentation/transforms.py for an example |
By the way, in #1104 we are slowly going to be starting to support PyTorch Tensors for some of the transforms natively in torchvision, so that this won't be an issue anymore |
According to the v0.8.0 release notes, multi-channel images are now natively supported! Thanks so much for everyone's hard work!!! |
Thanks @adamjstewart ! Let us know if you find any issues with it |
I actually just started a new research project using drone-based hyperspectral imagery (128+ spectral bands), so I'll definitely be testing this feature to the extreme! |
@adamjstewart were you able to train your model with multispectral images ? if yes ,can you please share what did you change in the dataloader ? |
I actually pivoted away from torchvision for transforms and used Kornia instead. Kornia had better support for MSI at the time and supports both single samples and batches of images. According to the torchvision docs:
So it may be possible to do everything you need without ever leaving torchvision. P.S. If you're working with satellite/plane/drone imagery, you may be interested in TorchGeo. If you're working with medical imagery I can't help you. Those are the two main applications of MSI that I know of. |
Multi-channel images are common in the fields of satellite remote sensing (GIS) and in medical imaging. Many of the multispectral satellites I work with in my research have 8+ spectral bands, not just RGB. Some hyperspectral satellites have as many as 136 spectral bands. Microscopy often involves 4+ channel images as well.
Currently, torchvision relies on the Python Imaging Library (PIL) for all of its transforms. Unfortunately, pillow does not support multi-channel images: python-pillow/Pillow#3160, python-pillow/Pillow#1888
The way I see it, researchers such as myself have 3 options:
I'm about to resort to 3 for my research. Do you have any suggestions for users like me?
The text was updated successfully, but these errors were encountered: