microsoft / farmvibes-ai

FarmVibes.AI: Multi-Modal GeoSpatial ML Models for Agriculture and Sustainability
https://microsoft.github.io/farmvibes-ai/
MIT License
686 stars 120 forks source link

SAM - Normalization and ChipWindow #184

Closed rafaspadilha closed 3 months ago

rafaspadilha commented 3 months ago

This PR replaces the ChipWindow named tuple with a tuple type alias. This fixes some serialization/deserialization errors that caused the workflow to break.

Additionally, this PR modifies how we scale and offset the raster values during normalization before SAM image encoder. After applying the raster's scale and offset normalization on the RGB bands, we now clip the values to the range [0,1] before multiplying them by 255. The lack of clipping operation was leading to inconsistencies in the segmentation masks outputs.