Skip to main content

A PydanticV2 validation and serialization libary for the STAC ML Model Extension

Project description

stac-model

Python support PyPI Release Repository Releases Docs

Contributions Welcome

Poetry Pre-commit Semantic versions Pipelines

A PydanticV2 validation and serialization library for the STAC ML Model Extension

Installation

pip install -U stac-model

or install with Poetry:

poetry add stac-model

Then you can run

stac-model --help

or with Poetry:

poetry run stac-model --help

Creating an example metadata json

poetry run stac-model

This will make an example example.json metadata file for an example model.

Currently this looks like

{
  "mlm_input": {
    "name": "13 Band Sentinel-2 Batch",
    "bands": [],
    "input_array": {
      "shape": [
        -1,
        13,
        64,
        64
      ],
      "dim_order": "bchw",
      "dtype": "float32"
    },
    "norm_type": "z_score",
    "rescale_type": "none",
    "norm_by_channel": true,
    "statistics": {
      "mean": [
        1354.40546513,
        1118.24399958,
        1042.92983953,
        947.62620298,
        1199.47283961,
        1999.79090914,
        2369.22292565,
        2296.82608323,
        732.08340178,
        12.11327804,
        1819.01027855,
        1118.92391149,
        2594.14080798
      ],
      "stddev": [
        245.71762908,
        333.00778264,
        395.09249139,
        593.75055589,
        566.4170017,
        861.18399006,
        1086.63139075,
        1117.98170791,
        404.91978886,
        4.77584468,
        1002.58768311,
        761.30323499,
        1231.58581042
      ]
    },
    "pre_processing_function": "https://github.com/microsoft/torchgeo/blob/545abe8326efc2848feae69d0212a15faba3eb00/torchgeo/datamodules/eurosat.py"
  },
  "mlm_architecture": {
    "name": "ResNet-18",
    "summary": "Sourced from torchgeo python library, identifier is ResNet18_Weights.SENTINEL2_ALL_MOCO",
    "pretrained": true,
    "total_parameters": 11700000
  },
  "mlm_runtime": {
    "framework": "torch",
    "version": "2.1.2+cu121",
    "asset": {
      "href": "."
    },
    "source_code_url": "https://github.com/huggingface/pytorch-image-models/blob/b5a4fa9c3be6ac732807db7e87d176f5e4fc06f1/timm/models/resnet.py#L362",
    "handler": "torchgeo.models.resnet.ResNet18"
  },
  "mlm_output": {
    "task": "classification",
    "number_of_classes": 10,
    "output_shape": [
      -1,
      10
    ],
    "class_name_mapping": {
      "Annual Crop": 0,
      "Forest": 1,
      "Herbaceous Vegetation": 2,
      "Highway": 3,
      "Industrial Buildings": 4,
      "Pasture": 5,
      "Permanent Crop": 6,
      "Residential Buildings": 7,
      "River": 8,
      "SeaLake": 9
    }
  }
}

:chart_with_upwards_trend: Releases

You can see the list of available releases on the GitHub Releases page.

:page_facing_up: License

License

This project is licenced under the terms of the Apache Software License 2.0 licence. See LICENSE for more details.

:heartpulse: Credits

Python project templated from galactipy.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

stac_model-0.1.1a1.tar.gz (13.7 kB view details)

Uploaded Source

Built Distribution

stac_model-0.1.1a1-py3-none-any.whl (13.6 kB view details)

Uploaded Python 3

File details

Details for the file stac_model-0.1.1a1.tar.gz.

File metadata

  • Download URL: stac_model-0.1.1a1.tar.gz
  • Upload date:
  • Size: 13.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.7.1 CPython/3.10.12 Linux/6.2.0-39-generic

File hashes

Hashes for stac_model-0.1.1a1.tar.gz
Algorithm Hash digest
SHA256 22085a1cbf1228d55019d8951c8fceea1cc5672bf1cf4ae8d82b90725120e2ef
MD5 7dad8caa796c49b1987c28b7ee9903ae
BLAKE2b-256 f48f2834e41460005f376acf0b605e30be387d608fbc8eb84c60b2e357ca12a9

See more details on using hashes here.

Provenance

File details

Details for the file stac_model-0.1.1a1-py3-none-any.whl.

File metadata

  • Download URL: stac_model-0.1.1a1-py3-none-any.whl
  • Upload date:
  • Size: 13.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.7.1 CPython/3.10.12 Linux/6.2.0-39-generic

File hashes

Hashes for stac_model-0.1.1a1-py3-none-any.whl
Algorithm Hash digest
SHA256 de8e65d3c806b7d3457f18690b61d8b00a404fdf27e4c075f03cd30ce43ad2eb
MD5 67bdadcbf70e56860b8efc122fb7925e
BLAKE2b-256 205d719a9b896c1f78b5f6174608b8d1674301a63cd54616c93f315071482af5

See more details on using hashes here.

Provenance

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page