Skip to main content

GHOST: Generalizable Hyperspectral Observation & Segmentation Toolkit

Project description

GHOST

Generalizable Hyperspectral Observation & Segmentation Toolkit

97.5% OA | 0.86 mIoU on Indian Pines — trained on a laptop GPU in 77 minutes.

pip install ghost-hsi

What is GHOST?

GHOST is a hyperspectral image segmentation framework. Point it at any .mat hyperspectral dataset and get a segmentation map — no code, no pipeline configuration, no PCA.

It runs on consumer hardware (RTX 3050, 6 GB VRAM) and handles any band count, class count, or spatial resolution automatically.

ghost train_rssp \
  --data data.mat --gt labels.mat \
  --routing forest --loss dice \
  --out-dir runs/my_experiment

ghost predict \
  --data data.mat --gt labels.mat \
  --model runs/my_experiment/rssp_models.pkl \
  --routing forest --out-dir runs/my_experiment

Why GHOST?

No PCA Required

Every major hyperspectral deep learning method requires PCA as a preprocessing step — choosing how many components to retain, accepting discarded spectral information. For non-standard domains (planetary science, medical imaging, novel sensors), this is a barrier and a source of information loss.

GHOST uses Continuum Removal: a physics-informed normalisation that strips brightness variation and isolates absorption feature shape. All spectral bands preserved. No dimensionality choices.

Fully Data-Agnostic

Band count, class count, spatial dimensions — all read from the file at runtime. Nothing is hardcoded. The same binary that segments Indian Pines (200 bands, 16 classes) also handles lung cancer pathology slides (61 bands, 3 classes) and Mars CRISM data — with zero code changes.

Runs on Consumer Hardware

Full training on a 6 GB laptop GPU. No A100s, no cloud compute, no multi-GPU setups. Designed for researchers who don't have institutional compute access.


Results

All results: --train_ratio 0.2 --val_ratio 0.1 --seed 42, forest routing, NVIDIA RTX 3050 (6 GB).

Indian Pines

Config OA mIoU Dice Kappa Time
64 base / 32 num filters 97.52% 0.8593 0.9038 0.9717 6h 2m
32 base / 8 num filters 97.55% 0.8027 0.8391 0.9721 77m
Per-class IoU (64/32 config)
Class IoU Class IoU
1 0.9143 9 0.1905
2 0.9351 10 0.9547
3 0.9425 11 0.9689
4 0.8811 12 0.9607
5 0.9415 13 0.9592
6 0.9961 14 0.9694
7 0.4286 15 0.9890
8 0.9256 16 0.7910

Classes 7 and 9 have <30 training samples. Low IoU on these is expected and consistent with published literature.

Salinas Valley

Results pending re-run with latest pipeline. Space reserved.

Config OA mIoU Dice Kappa Time

Pavia University

Results pending re-run with latest pipeline. Space reserved.

Config OA mIoU Dice Kappa Time

LUSC (Lung Squamous Cell Carcinoma)

Single image only (1 of 62). Not comparable to published benchmarks. Trained on a 512x512 crop with same-region pixel split. Published methods use patient-level cross-validation across 10 patients. These numbers demonstrate data-agnostic capability, not SOTA claims.

Metric Value
OA 99.43%
mIoU 88.96%
Dice 93.49%
Kappa 0.9878

See LUSC_ghost_report.md for full details on why these results are not directly comparable.

Mars CRISM / Asteroid Ryugu

Tested on planetary remote sensing data. Results in early exploration phase — not benchmarked against published methods.


Quick Start

Install

pip install ghost-hsi

Train

ghost train_rssp \
  --data data/indian_pines/Indian_pines_corrected.mat \
  --gt   data/indian_pines/Indian_pines_gt.mat \
  --loss dice --routing forest \
  --base_filters 32 --num_filters 8 \
  --forests 5 --leaf_forests 3 \
  --epochs 400 --patience 50 --min_epochs 40 \
  --out-dir runs/indian_pines

Predict

ghost predict \
  --data  data/indian_pines/Indian_pines_corrected.mat \
  --gt    data/indian_pines/Indian_pines_gt.mat \
  --model runs/indian_pines/rssp_models.pkl \
  --routing forest --out-dir runs/indian_pines

Visualize

ghost visualize \
  --data    data/indian_pines/Indian_pines_corrected.mat \
  --gt      data/indian_pines/Indian_pines_gt.mat \
  --model   runs/indian_pines/rssp_models.pkl \
  --dataset indian_pines --routing forest \
  --out-dir runs/indian_pines

Hardware Requirements

Setting VRAM Flags Indian Pines Time
Lightweight 4 GB --base_filters 16 --num_filters 4 --d_model 32 ~30m
Standard 6 GB --base_filters 32 --num_filters 8 ~77m
Full 8 GB+ --base_filters 64 --num_filters 32 ~6h

No multi-GPU support. Single consumer GPU is all you need.


Data Format

GHOST accepts .mat files (MATLAB/HDF5 format):

  • Data file: 3D array with shape (H, W, Bands) — the hyperspectral cube
  • Ground truth file: 2D array with shape (H, W) — integer class labels, 0 = background

Keys inside the .mat file are auto-detected by array dimensionality. No configuration needed.

Standard datasets (Indian Pines, Pavia University, Salinas Valley) are available from the GIC group at UPV/EHU.


Architecture Overview

.mat file (H, W, Bands)
    |
    v
Continuum Removal ---- physics-based normalisation, no PCA
    |
    v
Spectral 3D Conv ----- learns cross-band features, kernel (7,3,3)
    |
    v
SE Attention ---------- per-channel importance weighting
    |
    v
2D U-Net -------------- multi-scale spatial context
    |
    v
RSSP Tree ------------- recursive binary class splitting
    |                   each node: independent forest ensemble
    v
Prediction Map (H, W)

See architecture.md for technical details.


Documentation

Document Description
Architecture Pipeline components, RSSP tree, training details
API Reference All CLI commands and flags
TODO Roadmap, known limitations, planned features

License

Proprietary. All rights reserved. See LICENSE.

For source code access, research collaborations, or licensing inquiries, contact the author directly.


Citation

If you use GHOST in your research, please cite:

@software{ghost2026,
  title  = {GHOST: Generalizable Hyperspectral Observation \& Segmentation Toolkit},
  author = {Ishu},
  year   = {2026},
  url    = {https://pypi.org/project/ghost-hsi/}
}

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

ghost_hsi-0.1.4.tar.gz (1.9 MB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

ghost_hsi-0.1.4-cp312-cp312-win_amd64.whl (824.9 kB view details)

Uploaded CPython 3.12Windows x86-64

ghost_hsi-0.1.4-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (5.9 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

ghost_hsi-0.1.4-cp312-cp312-macosx_11_0_arm64.whl (859.7 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

ghost_hsi-0.1.4-cp311-cp311-win_amd64.whl (843.0 kB view details)

Uploaded CPython 3.11Windows x86-64

ghost_hsi-0.1.4-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (5.6 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

ghost_hsi-0.1.4-cp311-cp311-macosx_11_0_arm64.whl (877.4 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

ghost_hsi-0.1.4-cp310-cp310-win_amd64.whl (846.1 kB view details)

Uploaded CPython 3.10Windows x86-64

ghost_hsi-0.1.4-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (5.3 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64

ghost_hsi-0.1.4-cp310-cp310-macosx_11_0_arm64.whl (887.1 kB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

ghost_hsi-0.1.4-cp39-cp39-win_amd64.whl (849.8 kB view details)

Uploaded CPython 3.9Windows x86-64

ghost_hsi-0.1.4-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (5.3 MB view details)

Uploaded CPython 3.9manylinux: glibc 2.17+ x86-64

ghost_hsi-0.1.4-cp39-cp39-macosx_11_0_arm64.whl (892.4 kB view details)

Uploaded CPython 3.9macOS 11.0+ ARM64

File details

Details for the file ghost_hsi-0.1.4.tar.gz.

File metadata

  • Download URL: ghost_hsi-0.1.4.tar.gz
  • Upload date:
  • Size: 1.9 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for ghost_hsi-0.1.4.tar.gz
Algorithm Hash digest
SHA256 64d55f2b3be5e23c7ec003f20f49ca566efd7cd09ffba825e2ca30900b0489b7
MD5 6229216eb95817e914fe673b0b26b5e2
BLAKE2b-256 6370f56f2d2837bbec1882f13d16d9639eb01e3df7751ad780fe96ce92426a52

See more details on using hashes here.

Provenance

The following attestation bundles were made for ghost_hsi-0.1.4.tar.gz:

Publisher: publish.yml on IshuIsAwake/GHOST

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file ghost_hsi-0.1.4-cp312-cp312-win_amd64.whl.

File metadata

  • Download URL: ghost_hsi-0.1.4-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 824.9 kB
  • Tags: CPython 3.12, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for ghost_hsi-0.1.4-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 6d9dc568ab6419937d356992cdf13d60b1c7b0d0ebb7091efdf321a9fbbd2f96
MD5 0bd3b842dd9bcfe4a5827f6a922ec863
BLAKE2b-256 bace896cbaa5cd9e7a76306ba4b370534f5de71a8e7d969434e4e5be136948c3

See more details on using hashes here.

Provenance

The following attestation bundles were made for ghost_hsi-0.1.4-cp312-cp312-win_amd64.whl:

Publisher: publish.yml on IshuIsAwake/GHOST

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file ghost_hsi-0.1.4-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for ghost_hsi-0.1.4-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 95f7bd9069f6e8eeae7b7ebcc6b90144aa9ede6072592786f98f8041b92491c9
MD5 5ba69548f0abffa5ecbbb581b6406357
BLAKE2b-256 4cc8b24d9177453b3795e66f64ca79cae8e8e1b7310fe31bdea8222b5d0226b3

See more details on using hashes here.

Provenance

The following attestation bundles were made for ghost_hsi-0.1.4-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: publish.yml on IshuIsAwake/GHOST

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file ghost_hsi-0.1.4-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for ghost_hsi-0.1.4-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 7529daaecee568a6973b6d4b985e9970d7e44fa3a093fcdb27c1117b82811216
MD5 f598c154216e7c9a86fa11d04394dcd8
BLAKE2b-256 0b9d0b956c09bde506885123c3acfa35839e74c160e29ec4ab924fbfdb5109c9

See more details on using hashes here.

Provenance

The following attestation bundles were made for ghost_hsi-0.1.4-cp312-cp312-macosx_11_0_arm64.whl:

Publisher: publish.yml on IshuIsAwake/GHOST

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file ghost_hsi-0.1.4-cp311-cp311-win_amd64.whl.

File metadata

  • Download URL: ghost_hsi-0.1.4-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 843.0 kB
  • Tags: CPython 3.11, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for ghost_hsi-0.1.4-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 22b51a48a2e7c86fd7e72ffaa34bcee326a50d5d6d6029a4b831962294233656
MD5 217d16984311f9f34845e90af008246b
BLAKE2b-256 b68b4a158fd328220927a530e9dfdf3776f85df477a791c1b15d3c93be920013

See more details on using hashes here.

Provenance

The following attestation bundles were made for ghost_hsi-0.1.4-cp311-cp311-win_amd64.whl:

Publisher: publish.yml on IshuIsAwake/GHOST

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file ghost_hsi-0.1.4-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for ghost_hsi-0.1.4-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 363682b7730d6cfd7aac0b97e3a1fba1ddce21b2831960e5448fc35e58326f49
MD5 f5233771f530ff55343cee320f42bfc6
BLAKE2b-256 cda3a2518be9303310f1186aade95d3e09bf1cd4f689681c3290056ba17aedc1

See more details on using hashes here.

Provenance

The following attestation bundles were made for ghost_hsi-0.1.4-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: publish.yml on IshuIsAwake/GHOST

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file ghost_hsi-0.1.4-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for ghost_hsi-0.1.4-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 eb23081c9847d26a7c26d75c5561e296beb49442613fa680bc756ff2008c9373
MD5 e9a28a0fc311364ec6ec29eb783f295b
BLAKE2b-256 e6532b288002797a66cdc548c4573082c98349a2d428ee73d82c6f901aef950f

See more details on using hashes here.

Provenance

The following attestation bundles were made for ghost_hsi-0.1.4-cp311-cp311-macosx_11_0_arm64.whl:

Publisher: publish.yml on IshuIsAwake/GHOST

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file ghost_hsi-0.1.4-cp310-cp310-win_amd64.whl.

File metadata

  • Download URL: ghost_hsi-0.1.4-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 846.1 kB
  • Tags: CPython 3.10, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for ghost_hsi-0.1.4-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 0b0d060f0658f25fd00fa0673d7e42aa2bc4af92c2e785a83dcfd279db364ec3
MD5 40bdf69466f3c2eea5cd460edfea488c
BLAKE2b-256 63fc520afcc4463f4cc43e949c4377014b1b333ff2e8e3844e4b5668c3943266

See more details on using hashes here.

Provenance

The following attestation bundles were made for ghost_hsi-0.1.4-cp310-cp310-win_amd64.whl:

Publisher: publish.yml on IshuIsAwake/GHOST

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file ghost_hsi-0.1.4-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for ghost_hsi-0.1.4-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 114f8411e42cca5556c6c4f0008cf65411ab690434dbe332d0be46d76439afd5
MD5 1f359be122e035adb8b125b7d4dc6491
BLAKE2b-256 b68f9a8762e5615fb983c4c2dc0905adef1c4c7533d4443389a249b6a0bbccc6

See more details on using hashes here.

Provenance

The following attestation bundles were made for ghost_hsi-0.1.4-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: publish.yml on IshuIsAwake/GHOST

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file ghost_hsi-0.1.4-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for ghost_hsi-0.1.4-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 d10aa5043433404e69f0362b392408d5ca8d397fabb4386343f072939f505a06
MD5 8704b0b5cb8ea84587b0bad17396a6e1
BLAKE2b-256 8885f57293f46bba53c2aa0e851b84b8fb77714de2b9565f73ccc408720b70c6

See more details on using hashes here.

Provenance

The following attestation bundles were made for ghost_hsi-0.1.4-cp310-cp310-macosx_11_0_arm64.whl:

Publisher: publish.yml on IshuIsAwake/GHOST

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file ghost_hsi-0.1.4-cp39-cp39-win_amd64.whl.

File metadata

  • Download URL: ghost_hsi-0.1.4-cp39-cp39-win_amd64.whl
  • Upload date:
  • Size: 849.8 kB
  • Tags: CPython 3.9, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for ghost_hsi-0.1.4-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 f12e4629d9497daed0746fdf8ad1f96a7a2b8ac5cbd4a8b406113fc2650c43a8
MD5 9d9b83af0b86b036582768c5317d1c69
BLAKE2b-256 710321a7307b2174813b20a1dea84c84350155d69c8fd8da92093888610b9a3b

See more details on using hashes here.

Provenance

The following attestation bundles were made for ghost_hsi-0.1.4-cp39-cp39-win_amd64.whl:

Publisher: publish.yml on IshuIsAwake/GHOST

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file ghost_hsi-0.1.4-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for ghost_hsi-0.1.4-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 1517105ddfc53846b0b5e3968d1c78ea79a01548d11de363c52d0b6dc6961bfb
MD5 ab1dbab20e52cc7ce10c5b7d910777c5
BLAKE2b-256 2701e385321b9dbc288e2362c4f7a6fa95cacf2b750e546a6a157cfad683d64d

See more details on using hashes here.

Provenance

The following attestation bundles were made for ghost_hsi-0.1.4-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: publish.yml on IshuIsAwake/GHOST

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file ghost_hsi-0.1.4-cp39-cp39-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for ghost_hsi-0.1.4-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 c21a3a7424079209a67fbfa72e28f7011e2407f4584940c789164f76335412c8
MD5 417f5b0e6ddc553ef42f2ca36c9e734e
BLAKE2b-256 2ab740a597ad81a0e34246f88e5abd8013f378d910e25b01b2120665dae5a1e1

See more details on using hashes here.

Provenance

The following attestation bundles were made for ghost_hsi-0.1.4-cp39-cp39-macosx_11_0_arm64.whl:

Publisher: publish.yml on IshuIsAwake/GHOST

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

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