Jan 2025 – Jun 2025
AILast edited
Deep Learning for Segmentation of Hyperspectral Satellite Images
This project trained convolutional neural networks for semantic segmentation of hyperspectral satellite imagery from the HYPSO-2 mission, classifying each pixel as sea, land, or cloud.
The pipeline addresses the challenge of training on imagery with hundreds of spectral bands per pixel, orders of magnitude richer than RGB but far more compute-intensive. NVIDIA GPU cluster acceleration was used to optimize training speed and enable rapid model iteration.
Affiliation
NTNU SmallSat Lab
Partners
Report
- Manuscript
Keywords
- Hyperspectral Imaging
- Semantic Segmentation
- Convolutional Neural Networks
- Lightweight Models
- Earth Observation
- Spectral Signatures
- Python
- PyTorch
- CUDA
- ENVI 5
▸ Deepdive
Introduction
This project, carried out for the NTNU SmallSat Lab in spring 2025, adapts the 1D-JustoLiuNet convolutional neural network, originally trained on hyperspectral imagery from the HYPSO-1 CubeSat, to imagery from its successor satellite, HYPSO-2. The downstream goal is on-board per-pixel segmentation of every image into one of three surface classes (sea, land, cloud), so that the spacecraft can prioritise which data to downlink over a limited communication window. The interesting result is not that the adapted network works, it does, on easy data, but that its accuracy collapses from on near-identical imagery to on geographically diverse imagery, and the writeup is mostly about diagnosing why.
Problem Definition
A HYPSO-2 image is a hyperspectral cube , where and are spatial dimensions and is the number of contiguous spectral bands spanning visible to near-infrared. Each pixel is its own reflectance spectrum; the task is to learn a classifier that takes one pixel’s spectrum and emits its surface class, applied independently across all pixels to produce a segmentation map. Critically, is a function of the spectrum only, no spatial neighbourhood, no texture, no context, which is the central architectural commitment that the project is testing.
Per-pixel ground truth is generated by semi-automatic labelling in ENVI (the standard tool for hyperspectral remote-sensing analysis), producing .dat label files aligned to BIP-formatted (Band-Interleaved-by-Pixel) .bip image files. Before any spectrum reaches the network it is normalised band-by-band per image,
mapping each band’s values into approximately . Training minimises a softmax cross-entropy loss with label smoothing,
over per-pixel predictions, with AdamW as the optimiser (, decoupled weight decay) and StepLR as the scheduler. Reported per-class metrics are precision, recall, , support, and a macro-/weighted-average roll-up plus a confusion matrix; the headline metric is weighted-average over the three classes.
Background
The spectral-signature assumption is the load-bearing idea behind every model in this family: different surface materials reflect different wavelengths with characteristically different intensities, and a high-resolution reflectance vector across contiguous bands carries enough information to identify the material even without spatial context.

A neural network is the canonical learnable function for problems where the mapping from input to label is too complex to write down analytically. The base unit is a neuron that computes followed by a non-linear activation ; stacking many such units across input, hidden, and output layers gives the network the capacity to represent arbitrarily complex decision surfaces, with the weights and biases learned end-to-end by gradient descent on a loss function.

A convolutional neural network specialises this structure for inputs with spatial or sequential locality: instead of every output unit being connected to every input unit, each output unit looks at a small local window of the input through a shared learnable kernel that slides across the input. This is exactly the right inductive bias for image-like or spectrum-like inputs, because local structure (an edge, a narrow absorption band, a characteristic spectral slope) is more informative than any individual pixel or band on its own.

The mathematical primitive at every convolutional layer is the same convolution sum,
with the learnable kernel acting as a tunable band-pass detector. A stack of such convolutions, each followed by a ReLU non-linearity and a MaxPool over the spectral axis, builds an increasingly abstract spectral feature hierarchy; a final fully-connected layer maps that feature vector to three class logits.
1D-JustoLiuNet itself is a lightweight published architecture (Justo et al., 2025) that was designed for the on-board compute budget of a CubeSat: four sequential Conv1D + ReLU + MaxPool1D blocks, a flatten, and a single Linear projection to the class space. The forward pass is small enough to run pixel-by-pixel at the spacecraft’s clock rate, and the published accuracy on HYPSO-1 imagery is on a relatively homogeneous evaluation set, which is the number this project is trying to reach (or beat) on HYPSO-2.
Approach
The system decomposes into the hyperspectral input path, the 1D-JustoLiuNet model, and the training loop with its diagnostics. Each ### subsection below pulls one of these out.
Hyperspectral Input Path
The HYPSO-2 imager produces BIP-formatted hyperspectral cubes, where each pixel’s full spectral profile is laid out contiguously in memory, a layout that is exactly right for per-pixel spectral models, since a single sequential read pulls the entire input vector for one network call. Labels are produced semi-automatically in ENVI by combining spectral thresholds with manual cleanup; the resulting .dat files give one of three integer class IDs per pixel. The labels are not perfect, ENVI’s thresholding routinely mistakes sea pixels near clouds for land, and several training images carry visible mislabels (cf. Figure 21 in the report), which becomes a load-bearing problem in the results.
The min-max normalisation is applied per image, per band. The motivation is the standard one: bring all features onto a common scale so the network doesn’t have to learn the per-band dynamic range from scratch. The hidden cost, which this project ended up paying, is that per-image normalisation compresses the between-image spectral variability that the network actually needs to generalise. A sea pixel under Norwegian winter light and a sea pixel under tropical mid-day light have meaningfully different absolute reflectance spectra; per-image normalisation pushes both into roughly and erases that signal.
1D-JustoLiuNet
The forward pass is the four-block convolutional stack followed by a flatten and a fully-connected output. Each block applies a 1D convolution along the spectral axis, a ReLU,
and a 1D max-pool that strides over the spectral axis to compress the feature map. After four such blocks the activations are flattened into a single vector and projected to three logits by a Linear layer; an argmax over the logits gives the predicted class. The network has no batch normalisation, no dropout, and no skip connections, by design, for the on-board compute budget. The cost of those omissions shows up later: ReLU without dropout is prone to neuron death (units that get stuck outputting zero and never recover) and to overfitting, both of which the diversity tests expose.
Training and Evaluation Setup
Training runs on an NVIDIA RTX 3080 with CUDA through PyTorch. The hyperparameters are deliberately conventional, batch size , learning rate , label smoothing , epochs, AdamW with decoupled weight decay, StepLR for staircase learning-rate decay, so that any pathological result is attributable to the architecture or the data, not to a fragile training recipe. MLflow tracks per-epoch train/eval accuracy, loss, the full confusion matrix, and per-class precision, recall, , and support, plus the macro and weighted averages.
The evaluation is structured around six controlled tests T01–T06 that vary in difficulty along two axes: how similar the evaluation images are to the training images (similarity index ), and how visually homogeneous the dataset itself is. T01–T03 are sanity-check easy regimes; T04 is the medium similarity test; T05 and T06 are the hard diversity tests in which train and eval are drawn from a pool of geographically and environmentally varied imagery, the regime that mirrors actual operational deployment.
| Test | Type | Difficulty | Images | Sim. index |
|---|---|---|---|---|
| T01 | Sanity | Easy | 6 | 1 |
| T02 | Sanity | Easy | 8 | 0 |
| T03 | Sanity | Easy | 25 (× 1 image) | 1 |
| T04 | Similarity | Medium | 9 | 1 |
| T05 | Diversity | Hard | 12 | 0 |
| T06 | Diversity | Hard | 27 | 0 |
Results
The headline observation across all six tests is a clean monotonic degradation as the dataset becomes more diverse:
| Test | Accuracy | Weighted | Macro | Notable failure |
|---|---|---|---|---|
| T01 (sanity) | cloud , class collapse | |||
| T02 (sanity) | balanced, best macro- | |||
| T03 (sanity, replicated image) | majority-class memorisation | |||
| T04 (similarity) | cloud | |||
| T05 (diversity) | sea / land confused | |||
| T06 (diversity) | chance for three classes |
Two of these numbers are worth dwelling on. T03 trains on copies of a single image and evaluates on the same image; accuracy looks great () but macro- is because the model has simply memorised the majority class, the confusion matrix shows essentially all cloud pixels predicted as land. T06 is the realistic deployment regime, visually diverse images, low internal similarity, and weighted collapses to , which for a three-class problem is barely above the majority-class baseline.





The published 1D-JustoLiuNet paper reports evaluation accuracy on HYPSO-1 imagery, which is a -point gap to T06. Four mechanisms together account for this:
1 · Per-image min-max normalisation compresses inter-image variability. Because each image is independently rescaled to , the natural spectral differences between scenes captured under different lighting, atmospheric, and seasonal conditions are flattened out. A sea pixel from one orbit and a sea pixel from another can land at similar normalised values even when their raw spectra are genuinely different, which makes it harder for the network to learn globally-consistent class boundaries.
2 · Label noise. ENVI’s semi-automatic labelling produces mislabels at sea / cloud boundaries (sea pixels near clouds frequently get marked as land). With training data this noisy, the network is being asked to fit signal and noise together; under cross-entropy loss the noisy gradient pulls the decision boundaries away from where they should be.
3 · Class imbalance. Every test exhibits the same fingerprint, the class with the largest support has the highest , and the rarest class is the one the network drops first. T01’s cloud of is the most extreme case. Cross-entropy loss is inherently biased toward majority classes unless explicitly reweighted, and the loss configuration here uses only label smoothing for regularisation, not class weights.
4 · ReLU without dropout. Standard ReLU is prone to neuron death, units that consistently receive negative inputs during training get stuck outputting zero and stop receiving gradient. Combined with the absence of dropout, the network is free to memorise the training set rather than develop generalising features. The train-vs-eval-accuracy gap on T05 and T06 is the visual signature of exactly this failure mode.

Future Work
The central finding of the project is that spectral signatures alone are not enough for a model deployed across truly diverse imagery, and the strongest available remedy is to bring spatial information back into the model. Moving from a 1D CNN over a single pixel’s spectrum to a 2D or 3D CNN that operates over a spectral patch lets the model learn texture, edge, and neighbourhood cues, exactly the cues that distinguish a thin cloud over sea (which 1D-JustoLiuNet has no defence against) from a uniform stretch of land. The cost is non-trivial compute and memory on a CubeSat, but the architectural literature on hyperspectral classification has converged on this answer for a reason: even modest spatial context dramatically improves robustness to lighting and atmospheric variability.
A cheaper second avenue is rethinking the normalisation. Per-image min-max scaling is the standard for hyperspectral data, but in this project it is actively counter-productive because it strips the between-image variability the network needs. A global normalisation computed once across the training corpus, or a learnable per-band normalisation layer, would preserve scene-to-scene spectral differences while still keeping inputs on a stable scale.
The training recipe itself has obvious low-hanging fixes that the conservative hyperparameter choice in this project deliberately did not include. Swapping ReLU for Leaky ReLU keeps a small gradient flowing through “dead” units. Adding dropout (even between blocks) forces the network to spread information across units rather than memorise. Class-reweighted cross-entropy or focal loss directly attacks the class-imbalance bias that is consistently the dominant failure mode in the confusion matrices. None of these change the on-board compute budget, and any one of them should noticeably narrow the train-vs-eval gap on the diversity tests.
Finally, the cleanest single experiment that would resolve the open question in this writeup is to run 1D-JustoLiuNet on the exact dataset the original paper used and compare numbers head-to-head. The current -point gap to the paper’s accuracy is partly architectural and partly distributional, the paper’s evaluation set was visibly easier (no snow, low environmental variation), and without running the model on the original corpus, the project can’t isolate which fraction of the gap belongs to which cause. That comparison is the right next step before committing to any of the more expensive architectural changes above.