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.

Hidden files (names starting with ., such as the ._<name> companions macOS writes when copying to other disks) are never scenes; scene_stems(directory, suffix) lists the ids of one directory this way.

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.

Versioning

format_version is the format's major version; this release reads version 1.

  • Within version 1, optional fields may be added. A reader that does not know a field keeps it, ignores it and warns, naming it (it may also be a typo, such as temporl for temporal). Required fields and the meaning of existing fields never change within a version.
  • A change older readers would misread (a new required field, a field whose meaning changes, a new directory layout) bumps format_version. Reading a dataset of a newer version than the installed deepcontrail-core supports raises DatasetContractError asking to upgrade.

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.3.1

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.3.1
File Size Uploaded Provenance Actions
deepcontrail_core-0.3.1.tar.gz 23.1 kB With provenance Details for deepcontrail_core-0.3.1.tar.gz

Built distribution (wheel)

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

Total release size: 50.5 kB

Release files / deepcontrail_core-0.3.1.tar.gz

Download URL deepcontrail_core-0.3.1.tar.gz
Size 23.1 kB
Tags Source
SHA-256 checksum
How to use checksums
2eb1e55b7e59845082b5db1d532b18cb2e30cccbc2ccd5a23315246a0a766e5e
BLAKE2b-256 checksum
How to use checksums
f8b032d3809383a140346852910c5e8bb59c4bae0b182800b839bc43d93f3999
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 23, 2026.

Transparency log

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

Download URL deepcontrail_core-0.3.1-py3-none-any.whl
Size 27.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9f9d37ec471ef9c1e1cf7d7f9ef4cc3324b341bafabfb4f4dc71a676839b7471
BLAKE2b-256 checksum
How to use checksums
1c0bc6735cae61f1a7c22c962cd553f39ac7de2b9394e9a82658e40c4ea1d751
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 23, 2026.

Transparency log

Security for deepcontrail-core 0.3.1

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.3.1.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 23, 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