From 2b8729765ee7010d2e909ee5c5fe722d9e0c7fe6 Mon Sep 17 00:00:00 2001 From: Francis Charette-Migneault Date: Thu, 4 Apr 2024 14:57:37 -0400 Subject: [PATCH] add example bands and statitics details --- README.md | 5 + best-practices.md | 2 +- examples/example.json | 238 +++++++++++++++++++++++++++++++++++++--- json-schema/schema.json | 4 + 4 files changed, 235 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index 50087dd..1cbff67 100644 --- a/README.md +++ b/README.md @@ -307,6 +307,11 @@ Select one option from: See [OpenCV - Interpolation Flags](https://docs.opencv.org/4.x/da/d54/group__imgproc__transform.html#ga5bb5a1fea74ea38e1a5445ca803ff121) for details about the relevant methods. Equivalent methods from other packages are applicable as well. +When a normalization technique is specified, it is expected that the corresponding [Statistics](#bands-and-statistics) +parameters necessary to perform it would be provided for the corresponding input. +For example, the `min-max` normalization would require that at least the `minimum` and `maximum` statistic properties +are provided, while the `z-score` would require `mean` and `stddev`. + If none of the above values applies, `null` (literal, not string) can be used instead. If a custom normalization operation, or a combination of operations (with or without [Resize](#resize-enum)), must be defined instead, consider using a [Processing Expression](#processing-expression) reference. diff --git a/best-practices.md b/best-practices.md index 578127b..7e14d3e 100644 --- a/best-practices.md +++ b/best-practices.md @@ -38,7 +38,7 @@ choose to apply it for contexts outside the *recommended* extent for the same re As another example, let us consider a model which is trained on imagery from all over the world and is robust enough to be applied to any time period. In this case, the common metadata to use with the model could include the bbox of "the world" `[-90, -180, 90, 180]` and the `start_datetime` and `end_datetime` range -would ideally be generic values like `["1900-01-01", null]` (see warning below). +would ideally be generic values like `["1900-01-01T00:00:00Z", null]` (see warning below). However, due to limitations with the STAC 1.0 specification, this time extent is not applicable. > [!WARNING] diff --git a/examples/example.json b/examples/example.json index ba10bba..f37231c 100644 --- a/examples/example.json +++ b/examples/example.json @@ -1,6 +1,11 @@ { - "type": "Feature", "stac_version": "1.0.0", + "stac_extensions": [ + "https://stac-extensions.github.io/mlm/v1.0.0/schema.json", + "https://stac-extensions.github.io/eo/v1.1.0/schema.json", + "https://stac-extensions.github.io/raster/v1.1.0/schema.json" + ], + "type": "Feature", "id": "resnet-18_sentinel-2_all_moco_classification", "geometry": { "type": "Polygon", @@ -29,8 +34,15 @@ ] ] }, + "bbox": [ + -7.882190080512502, + 37.13739173208318, + 27.911651652899923, + 58.21798141355221 + ], "properties": { - "start_datetime": "1900-01-01", + "datetime": null, + "start_datetime": "1900-01-01T00:00:00Z", "end_datetime": "9999-12-31T23:59:59Z", "mlm:name": "Resnet-18 Sentinel-2 ALL MOCO", "mlm:tasks": [ @@ -230,6 +242,216 @@ ], "post_processing_function": null } + ], + "eo:bands": [ + { + "name": "coastal", + "common_name": "coastal", + "description": "Coastal aerosol (band 1)", + "center_wavelength": 0.443, + "full_width_half_max": 0.027 + }, + { + "name": "blue", + "common_name": "blue", + "description": "Blue (band 2)", + "center_wavelength": 0.49, + "full_width_half_max": 0.098 + }, + { + "name": "green", + "common_name": "green", + "description": "Green (band 3)", + "center_wavelength": 0.56, + "full_width_half_max": 0.045 + }, + { + "name": "red", + "common_name": "red", + "description": "Red (band 4)", + "center_wavelength": 0.665, + "full_width_half_max": 0.038 + }, + { + "name": "rededge1", + "common_name": "rededge", + "description": "Red edge 1 (band 5)", + "center_wavelength": 0.704, + "full_width_half_max": 0.019 + }, + { + "name": "rededge2", + "common_name": "rededge", + "description": "Red edge 2 (band 6)", + "center_wavelength": 0.74, + "full_width_half_max": 0.018 + }, + { + "name": "rededge3", + "common_name": "rededge", + "description": "Red edge 3 (band 7)", + "center_wavelength": 0.783, + "full_width_half_max": 0.028 + }, + { + "name": "nir", + "common_name": "nir", + "description": "NIR 1 (band 8)", + "center_wavelength": 0.842, + "full_width_half_max": 0.145 + }, + { + "name": "nir08", + "common_name": "nir08", + "description": "NIR 2 (band 8A)", + "center_wavelength": 0.865, + "full_width_half_max": 0.033 + }, + { + "name": "nir09", + "common_name": "nir09", + "description": "NIR 3 (band 9)", + "center_wavelength": 0.945, + "full_width_half_max": 0.026 + }, + { + "name": "cirrus", + "common_name": "cirrus", + "description": "SWIR - Cirrus (band 10)", + "center_wavelength": 1.375, + "full_width_half_max": 0.026 + }, + { + "name": "swir16", + "common_name": "swir16", + "description": "SWIR 1 (band 11)", + "center_wavelength": 1.61, + "full_width_half_max": 0.143 + }, + { + "name": "swir22", + "common_name": "swir22", + "description": "SWIR 2 (band 12)", + "center_wavelength": 2.19, + "full_width_half_max": 0.242 + } + ], + "raster:bands": [ + { + "name": "coastal", + "common_name": "coastal", + "description": "Coastal aerosol (band 1)", + "center_wavelength": 0.443, + "full_width_half_max": 0.027 + }, + { + "nodata": 0, + "data_type": "uint16", + "bits_per_sample": 15, + "spatial_resolution": 10, + "scale": 0.0001, + "offset": 0, + "unit": "m" + }, + { + "nodata": 0, + "data_type": "uint16", + "bits_per_sample": 15, + "spatial_resolution": 10, + "scale": 0.0001, + "offset": 0, + "unit": "m" + }, + { + "nodata": 0, + "data_type": "uint16", + "bits_per_sample": 15, + "spatial_resolution": 10, + "scale": 0.0001, + "offset": 0, + "unit": "m" + }, + { + "nodata": 0, + "data_type": "uint16", + "bits_per_sample": 15, + "spatial_resolution": 20, + "scale": 0.0001, + "offset": 0, + "unit": "m" + }, + { + "nodata": 0, + "data_type": "uint16", + "bits_per_sample": 15, + "spatial_resolution": 20, + "scale": 0.0001, + "offset": 0, + "unit": "m" + }, + { + "nodata": 0, + "data_type": "uint16", + "bits_per_sample": 15, + "spatial_resolution": 20, + "scale": 0.0001, + "offset": 0, + "unit": "m" + }, + { + "nodata": 0, + "data_type": "uint16", + "bits_per_sample": 15, + "spatial_resolution": 10, + "scale": 0.0001, + "offset": 0, + "unit": "m" + }, + { + "nodata": 0, + "data_type": "uint16", + "bits_per_sample": 15, + "spatial_resolution": 20, + "scale": 0.0001, + "offset": 0, + "unit": "m" + }, + { + "nodata": 0, + "data_type": "uint16", + "bits_per_sample": 15, + "spatial_resolution": 60, + "scale": 0.0001, + "offset": 0, + "unit": "m" + }, + { + "nodata": 0, + "data_type": "uint16", + "bits_per_sample": 15, + "spatial_resolution": 60, + "scale": 0.0001, + "offset": 0, + "unit": "m" + }, + { + "nodata": 0, + "data_type": "uint16", + "bits_per_sample": 15, + "spatial_resolution": 20, + "scale": 0.0001, + "offset": 0, + "unit": "m" + }, + { + "nodata": 0, + "data_type": "uint16", + "bits_per_sample": 15, + "spatial_resolution": 20, + "scale": 0.0001, + "offset": 0, + "unit": "m" + } ] }, "links": [ @@ -261,15 +483,5 @@ "metadata" ] } - }, - "datetime": null, - "bbox": [ - -7.882190080512502, - 37.13739173208318, - 27.911651652899923, - 58.21798141355221 - ], - "stac_extensions": [ - "https://raw.githubusercontent.com/crim-ca/dlm-extension/main/json-schema/schema.json" - ] + } } diff --git a/json-schema/schema.json b/json-schema/schema.json index bf56f44..ed79f02 100644 --- a/json-schema/schema.json +++ b/json-schema/schema.json @@ -575,6 +575,10 @@ } ] }, + "InputStatistics": { + "$comment": "MLM statistics for the specific input relevant for normalization for ML features.", + "$ref": "https://stac-extensions.github.io/raster/v1.1.0/schema.json#/definitions/bands/items/properties/statistics" + }, "ProcessingExpression": { "oneOf": [ {