Sparse point supervision for semantic segmentation on the LoveDA dataset using DeepLabV3+, a custom PartialCrossEntropyLoss, and controlled experiments on annotation density and sampling strategy.
This repository started as a technical assessment and was polished into a portfolio project that demonstrates weakly supervised segmentation, custom loss design, and experiment-driven analysis in PyTorch.
Scope note: The reported metrics are from the documented final experiments in this repository. They are a reproducible project snapshot, not a claim of production model readiness or a substitute for broader benchmark evaluation.
Semantic segmentation usually assumes dense pixel-wise labels. In remote sensing, that assumption is expensive. Full masks take time to annotate, especially for large aerial images with multiple land-cover classes.
This project explores a more practical setup: training a segmentation model when only a very small fraction of pixels are labeled as points.
The central question is simple:
Can sparse point annotations still train a useful remote sensing segmentation model?
- A sparse-label generation pipeline that converts dense masks into point-supervised targets.
- A custom
PartialCrossEntropyLossthat computes loss only on labeled pixels and ignores unlabeled regions. - A
DeepLabV3+segmentation baseline with anImageNet-pretrainedResNet-50encoder. - An annotation-density experiment across
0.1%,0.5%,1.0%, and full supervision. - A sampling-strategy comparison between random and balanced point sampling at
0.1%. - Reproducible plots and a written technical report from the final run.
| Item | Value |
|---|---|
| Dataset | LoveDA |
| Framework | PyTorch + segmentation_models_pytorch |
| Model | DeepLabV3+ |
| Encoder | ResNet-50 with ImageNet pretrained weights |
| Optimizer | AdamW |
| Learning rate | 1e-4 |
| Batch size | 2 |
| Epochs per experiment | 2 |
| Full dataset pairs found | 4,191 |
| Train / validation split | 3,352 / 839 |
| Final experiment subset | 1,000 / 200 |
Instead of supervising every pixel, the project keeps only a small percentage of labeled pixels and marks the rest with an ignore index. The model is then trained only on those labeled points.
Two sparse-label strategies were tested:
- Random sampling: choose labeled pixels uniformly from valid mask locations.
- Balanced sampling: force at least one point from each class present in the image before filling the remaining point budget.
This setup makes it possible to study whether sparse supervision can approximate full-mask training closely enough to be useful.
| Setting | Train Loss | Val Pixel Accuracy | Val mIoU |
|---|---|---|---|
| Random points (0.1%) | 1.0216 | 0.6157 | 0.3160 |
| Random points (0.5%) | 1.0144 | 0.7025 | 0.4021 |
| Random points (1.0%) | 1.0180 | 0.6597 | 0.3510 |
| Full supervision (100%) | 1.0125 | 0.6871 | 0.3545 |
| Setting | Train Loss | Val Pixel Accuracy | Val mIoU |
|---|---|---|---|
| Random sampling (0.1%) | 1.0283 | 0.7088 | 0.3980 |
| Balanced sampling (0.1%) | 1.0175 | 0.6616 | 0.3488 |
0.5% random point supervision produced the strongest result in the density study, reaching the best validation mIoU in the final run.
Balanced sampling was tested as a class-coverage strategy, but in the final run it did not outperform random sampling at 0.1% supervision.
This view compares all final runs together and makes the relative ranking easier to scan quickly.
- Sparse point supervision can train a usable remote sensing segmentation model.
- A custom partial cross-entropy loss is enough to make sparse point training work cleanly in a standard segmentation pipeline.
- In this final run,
0.5%random point labels gave the strongest density-study result. - Balanced sampling did not improve over random sampling in the final
0.1%comparison. - The project is a solid proof of concept, but not yet a fully optimized benchmark.
- meriti_assessment.ipynb: end-to-end notebook with preprocessing, training, and experiments
- final_sparse_segmentation_report.md: final technical write-up
- assets/results_summary.csv: experiment summary used to generate the graphs
- assets/plots/: exported visualization assets for the README
- scripts/generate_graphs.py: reproducible graph-generation script
- requirements.txt: project dependencies
- Open meriti_assessment.ipynb in Colab.
- Run the dependency-install cell at the top of the notebook.
- Mount Google Drive if you want outputs saved.
- Let the notebook download the LoveDA dataset through
kagglehub. - Run the experiment cells near the end of the notebook.
pip install -r requirements.txtThen open the notebook in Jupyter and run it normally.
python scripts/generate_graphs.py- The final results come from a subset of the full split, not the full dataset.
- Each experiment was trained for only
2epochs. - Results were taken from single runs rather than averaged across multiple seeds.
- The project does not yet include semi-supervised learning, pseudo-labeling, ensembling, or longer training schedules.
These limitations matter, so the current results should be read as a strong prototype and portfolio project rather than a final benchmark claim.
- train for longer and compare multiple random seeds
- evaluate on a larger subset or the full split
- save intermediate predictions and qualitative segmentation outputs
- add experiment tracking and cleaner training utilities outside the notebook
- explore semi-supervised extensions such as pseudo-labeling
- The LoveDA dataset is not included in this repository.
- Model checkpoints are not included.
- The repository is designed to be easy to read, rerun, and discuss as a self-contained individual project.


