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

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

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

File metadata

  • Download URL: stac_model-0.1.1a0.tar.gz
  • Upload date:
  • Size: 13.8 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.1a0.tar.gz
Algorithm Hash digest
SHA256 95943af2d1f50da773b080727022f94ef2320d01074326e12948359361468967
MD5 33df9fb6e5be12ee5a6b2149a4842c83
BLAKE2b-256 38a642d015b964085f5f6198ba9ee34bdac5d86769c7d3ec455f520e2543d787

See more details on using hashes here.

Provenance

File details

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

File metadata

  • Download URL: stac_model-0.1.1a0-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.1a0-py3-none-any.whl
Algorithm Hash digest
SHA256 b95b96c985a961dd231aca11e0d7388777b44d3309458c350763cf22248cf497
MD5 75b13b1906b1ef60fb940afb1c3877ef
BLAKE2b-256 fe0d2bafb14355dc8596f72d67a6888a8643275397a946e0142295b84a92a422

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