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.1a2.tar.gz (13.7 kB view details)

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

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

File metadata

  • Download URL: stac_model-0.1.1a2.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.5.0-17-generic

File hashes

Hashes for stac_model-0.1.1a2.tar.gz
Algorithm Hash digest
SHA256 667e1fe1bcc3ffecfdc5f41c9c84650126aee89c618d07702c7950b791c6d6ab
MD5 3e3c41fb95281e7e8c9a65f41f491e5b
BLAKE2b-256 a7f17cc638ac722e6f87f3e417a32147a87951d1c0a21abef89588c9da1cbdbd

See more details on using hashes here.

Provenance

File details

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

File metadata

  • Download URL: stac_model-0.1.1a2-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.5.0-17-generic

File hashes

Hashes for stac_model-0.1.1a2-py3-none-any.whl
Algorithm Hash digest
SHA256 053b80f8028b0d64afba5bf6d5fe6c104ae3f192114dd1c7e1ac5a624d3dba15
MD5 8973a7adbf10a50cb004ff84bd77b487
BLAKE2b-256 36c6fdbadd7f50fa1e9a28a32d275dd84d98417d6add445ed6813821459fd0a0

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