Skip to main content

U-Net Segmentation

There are no manual galaxy masks in Galaxy10, so segmentation is weakly supervised: an Otsu-based teacher produces three-class pseudo-labels, and a U-Net is trained to reproduce and regularise them.

Pseudo-labels (the “teacher”)​

OtsuSegmenter (background percentile 5) builds a galaxy mask by Otsu threshold, hole filling and largest-component selection, then splits it:

ClassDefinition
0 — backgroundoutside the galaxy mask
1 — diskgalaxy mask, below the 80th percentile of galaxy pixel brightness
2 — “bulge”pixels above that percentile
The “bulge” is a brightness quantile

Class 2 is by construction the brightest 20 % of the galaxy's pixels, so the Otsu bulge fraction is 0.200 for every morphology class. It is not a physical bulge/disk decomposition. The U-Net learns this brightness criterion; its predicted bulge fraction (median 0.100) correlates only very weakly with colour (see Physical Interpretation).

Pseudo-label pixel shares on the training set: 9.5% background, 72.4% disk, 18.1% bulge; class weights in the loss compensate the imbalance.

Model and training​

U-Net (Ronneberger et al. 2015) with four encoder levels (64 → 512 filters), a 1,024-filter bottleneck with dropout 0.3 and bilinear up-sampling. Loss: 0.5 × Dice + 0.5 × cross-entropy (label smoothing 0.05, class weights 0.3 / 1.5 / 3.0). AdamW, learning rate 1 × 10⁻⁴, 20 epochs, FP16, best epoch by validation mean IoU.

Results​

0.540
Test mIoU
against Otsu pseudo-labels
80.7%
Pixel accuracy
all test pixels
39.6%
Bulge recall
brightest-quantile class
Provenance. Model scores in this section are copied from the output cells of the AstroVision notebooks (and, for DINOv2 per-class recall, read from an exported figure). The documentation data pack contains no metrics file for them, so they cannot be re-derived from the pack; the cell of origin is listed for each value in _facts/astrovision/FACTS_INDEX.md §3 and shown when hovering over a number.
Pixel class (test)PrecisionRecallF1
Background0.7220.6110.662
Disk0.8250.9350.876
“Bulge”0.7300.3960.513
Notebook 06, per-pixel classification report.
What the mIoU does and does not mean

The mIoU is measured against the Otsu pseudo-labels, not against human masks, so it quantifies how well the network reproduces its teacher. The comparison table in the project README (random ≈ 0.167, Otsu ≈ 0.500, “+4 % over the teacher”) has no counterpart in the notebook outputs and is not reproduced here: the teacher scored against itself is trivially perfect. The network misses most of the “bulge” pixels (recall 39.6%) because a quantile threshold is a noisy target at the pixel level.

By morphology class, the U-Net mIoU ranges from 0.355 (Cigar Shaped Smooth) to 0.517 (Unbarred Tight Spiral).

U-Net mIoU by galaxy class
0 · Disturbed0.41
1 · Merging0.42
2 · Round Smooth0.42
3 · In-between Round Smooth0.39
4 · Cigar Shaped Smooth0.35
5 · Barred Spiral0.49
6 · Unbarred Tight Spiral0.52
7 · Unbarred Loose Spiral0.44
8 · Edge-on without Bulge0.39
9 · Edge-on with Bulge0.37

Other segmenters​

DINOv2PatchSegmenter clusters patch features with k-means (k = 3, 4, 5 tried in the notebook) — a label-free alternative, shown qualitatively. SAMSegmenter (Segment Anything) is optional and was not run: its checkpoint was absent in the recorded notebook.

◎
Pseudo-label sample
Pseudo-label sample
Images with their Otsu pseudo-labels.
◎
Otsu pseudo-labels
Otsu pseudo-labels
Background / disk / bright core by thresholding.
◎
U-Net predictions
U-Net predictions
Test images with predicted masks.
◎
Three methods
Three methods
Otsu, DINOv2 patch clustering and U-Net.
◎
DINOv2 patch clusters
DINOv2 patch clusters
Self-supervised clustering of patch features.
◎
mIoU by morphology class
mIoU by morphology class
U-Net quality per galaxy class.
◎
Structure statistics
Structure statistics
Bulge fraction and components in U-Net masks.