Skip to main content

deepcontrail-core

Torch-free foundations of DeepContrail: the dataset format every task reads, its validation, false-colour composites built from named bands, the train/validation/fold partition, and Dice/IoU metrics.

Depends only on numpy, Pillow, pydantic and PyYAML. import deepcontrail.core never imports torch.

pip install deepcontrail-core

The DeepContrail dataset format (version 1)

The library reads this layout and nothing else. Any producer can write it; for OpenContrails the converter does.

<root>/
├── metadata/dataset_info.json               required: source, record counts, labels, pixel shift
├── spectral_bands/bands.json                required: what each channel of the arrays holds
├── spectral_bands/{train,test}/<id>.npy     required: (H, W, C) float32, e.g. brightness temperatures (K)
├── semantic_masks/{train,test}/<id>.png     binary consensus mask: 0 background, 255 contrail (1 accepted)
├── probability_masks/{train,test}/<id>.npy  (H, W) float32 annotator agreement in [0, 1]
├── annotator_masks/{train,test}/<id>.npy    (H, W, A) uint8 {0, 1}, one mask per annotator
├── instance_masks/{train,test}/<id>.npy     (N, H, W, A) int8: 1 = pixel of instance n for annotator a,
│                                             0 = not, -1 = instance not drawn by that annotator
├── images_semantic/{train,test}/<id>.jpg    optional preview for people; never read by the library
└── splits_{train,test}.txt                  optional: the labelled ids of each split
  • Splits. test/ is a holdout. The validation set is drawn from train/ at load time: the sorted ids are shuffled with the seed and the first val_fraction go to validation (or k-fold with fold / num_folds). Training runs record the exact lists and their fingerprints.
  • Ids are unique across splits and used as written: any file name is a valid id.
  • Context frames (unlabelled neighbouring time steps of a scene) exist only in a dataset that declares "temporal": true in dataset_info.json. There, <id>_b<k>.npy / <id>_a<k>.npy (k steps before / after scene <id>, which must exist) are context frames and need no labels. In any other dataset every file is a scene, so an id such as tile_a1 is an ordinary scene.
  • Labels are only required for the task at hand: semantic for segmentation, instance for instance segmentation. Every label kind declared in dataset_info.json must cover every labelled scene, at the size of its spectral array.

All JSON and text files (bands.json, dataset_info.json, splits_*.txt) must be UTF-8 encoded.

spectral_bands/bands.json

{
  "format_version": 1,
  "sensor": "GOES-16 ABI",
  "dtype": "float32",
  "channels": [
    {"index": 0, "key": "data_10um", "units": "K", "sensor_band": "13", "wavelength_um": 10.33},
    {"index": 1, "key": "data_11um", "units": "K", "sensor_band": "14", "wavelength_um": 11.19}
  ]
}

key (unique, snake_case) is the name configs use; index is the channel's position. The optional sensor_band, wavelength_um, name and derived_from ([a, b] for a channel stored as a - b) describe the band for people; the library never interprets them. Another sensor declares its own keys (for example ir_105, ir_123 for MTG FCI).

metadata/dataset_info.json

{
  "format_version": 1,
  "source": "OpenContrails GOES-16 ABI TFRecords",
  "records": {"train": 20088, "test": 1879},
  "labels": ["semantic", "probability", "annotator", "instance"],
  "recommended_pixel_shift": 0.0
}

recommended_pixel_shift is the shift (pixels, right and down) that aligns the images with the masks, or null if unknown. The data config's pixel_shift should use it; a dataset warns when they differ.

Optional fields:

  • temporal (true/false): whether the dataset stores context frames (see Context frames above). Absent means false.
  • export, naming, pixel_shift_note: provenance notes for people (for OpenContrails: the export date, how files are named, why the shift is what it is); the library does not read them.

Read both with read_band_manifest(root) and read_dataset_info(root); a missing or invalid file raises DatasetContractError naming the file.

Instance masks are read with deepcontrail.core.readers.load_instance_masks(path), which raises ValueError on an array that is not in the format above; extract_all_annotator_instances(raw) turns one into each annotator's list of boolean contrail masks.

Composites

A composite is three channels built from named bands, each one band or the difference of two, scaled from bounds to [0, 1]. The recipe lives in the experiment config:

data:
  false_color:
    channels:
      - {bands: [data_12um, data_11um], bounds: [-4, 2]}    # R
      - {bands: [data_11um, cloud_top], bounds: [-4, 5]}    # G
      - {bands: [data_11um],            bounds: [243, 303]} # B

false_color_from_spectral(bands, recipe, manifest) builds it; a band key the dataset does not declare is an error listing the available keys.

Validation

deepcontrail-validate <root> [--task segmentation|instance] [--deep]

The default checks read only the metadata and the file names (seconds): both metadata files, the task's labels, every labelled scene has its labels and no label lacks its scene, record counts and split lists. --deep also reads every file: arrays load with the declared channels and finite values, masks match their scene's size and hold valid values, all scenes share one size. It exits non-zero on any issue. From Python: validate_dataset(root, task=..., deep=...).

Metadata

Release files for deepcontrail-core 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for deepcontrail-core 0.1.0
File Size Uploaded Provenance Actions
deepcontrail_core-0.1.0.tar.gz 21.9 kB With provenance Details for deepcontrail_core-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for deepcontrail-core 0.1.0
File Interpreter ABI Platform Actions
deepcontrail_core-0.1.0-py3-none-any.whl Python 3 none any Details for deepcontrail_core-0.1.0-py3-none-any.whl

Total release size: 48.1 kB

Release files / deepcontrail_core-0.1.0.tar.gz

Download URL deepcontrail_core-0.1.0.tar.gz
Size 21.9 kB
Tags Source
SHA-256 checksum
How to use checksums
2dc3ad853877f46035654aa9c4ef35ddd25b81df38715228c55046b345c30af1
BLAKE2b-256 checksum
How to use checksums
3781ad5700851a48a3b7c102ce24e8917a61cdfc91c2aa11158ced9c3baf27fa
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 11, 2026.

Transparency log

Release files / deepcontrail_core-0.1.0-py3-none-any.whl

Download URL deepcontrail_core-0.1.0-py3-none-any.whl
Size 26.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f47c7164dda710b6f1cecd60669741e7bcea362157791a27e3ad060519425687
BLAKE2b-256 checksum
How to use checksums
4581bafd15e56324a4e9b432ae8dce127c27967eeba7b7b0de15f0ae31d7ea17
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 11, 2026.

Transparency log

Security for deepcontrail-core 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for deepcontrail_core-0.1.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 11, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page