Replies: 2 comments 4 replies
-
Hi @vonnonn thanks for using TorchGeo! We have a band normalization function at Regarding the indices, we do have some transforms for computing and appending indices in For weights, I would always recommend weights=True and to set the number of channels for the total number of bands+indices you are using. We use timm in the backend which will repeat pretrained ImageNet RGB weights like RGBRGBR for example id you have 7 channels. Hope this helps. |
Beta Was this translation helpful? Give feedback.
-
Adding to what @isaaccorley has already said:
You can. But you shouldn't. In machine learning, we usually normalize all images in an entire dataset to the same dynamic range. Otherwise, an image with a small cloud becomes mostly dark and an image without any clouds will become very bright. My suggestion would be to calculate the mean and std dev of all of your images, then normalize all of them using the same values. You can use a transform like Normalize to do this instead of writing your own code.
Your brightness calculation looks identical to our RandomGrayscale transform with the following settings: transform = RandomGrayscale(p=1) I've never seen your maxdiff transform before, so would have to think about that. P.S. We don't yet have builtin transforms for MNDWI or MaxDiff or builtin data loaders for MicaSense RedEdge-P, but if you feel like adding these, please open a PR! MNDWI in particular would be quite easy, as it seems to be identical to NDSI (which we already have). |
Beta Was this translation helpful? Give feedback.
-
I would like to segment imagery (~0.02 m) we collect from a MicaSense RedEdge-P sensor (B,G,R,RE,NIR) but I have some questions on preprocessing. Can I use a function like this to normalize the samples:
And then perform the same function with a band loop on the predicted imagery like this?
I would also like to use different indices than what are provided in the transform section, specifically, brightness and maxdiff:
I was adding these to the image stack along with NDVI, NDRE, and MNDWI for a total of 10 bands (channels) and then writing out a new geotiff. Is there a better way to do this? I normalized all the bands then wrote out the tiff to be read in by torchgeo and commented out the normalizing functions, but I couldn't get any predictions from it.
What would be the optimal setting for weights, True or None, or could I train just the RGB with pretrained weights and then random weights for the remaining channels?
Looking forward to regularly implementing torchgeo with our workflow!
Cheers,
Josh
Beta Was this translation helpful? Give feedback.
All reactions