- 🆕 01/2026: Code released.
- 🥳 01/2026: Paper accepted at Computer Vision for Earth Observation Workshop Series - WACV 2026.
SSeg is a framework for efficient multi-class image segmentation that expands sparse point annotations into full masks using a hybrid SAM2–superpixel strategy with active point sampling
conda create -n spuw python=3.10
conda activate spuw
pip install -r requirements.txtcd checkpoints/
./download_ckpts.sh- This machine uses CUDA 11.5.
- For best performance, use the same CUDA.
- If CUDA is not available, the code will automatically run on CPU.
You can run the framework in two modes:
Best for testing single images and visualizing results in real-time.
- Interactive GUI:
python app.py
Best for running experiments on full datasets and generating metrics.
- **Benchmark/Batch Mode:**
```bash
python run.py
(Requires ground truth images for point-label assignment)
To configure batch experiments, you do not use command-line arguments. Instead, you modify the configuration list directly inside run.py.
Open run.py and scroll to the experiments list (around line 220). Add a dictionary for each experiment you want to queue:
experiments = [
{
"name": "experiment_name", # Folder name for results
"strategy": "dynamicPoints", # Sampling strategy
"num_points": 25, # Point budget
"images": "path/to/images", # Input directory
"ground_truth": "path/to/gt", # GT directory (required for dynamic strategies)
# Advanced Parameters
"lambda_balance": 0.5, # (Dynamic only) Balance exploration/exploitation
"heatmap_fraction": 0.5, # (Dynamic only) % of points from uncertainty map
"maskSLIC": True, # Enable superpixel refinement
"visualizations": True # Save debug images
}
]These keys can be used inside the experiment dictionary in run.py:
Required
name: Identifier for the experiment (creates output subfolder).strategy: Active sampling logic:random,grid,list,dynamicPoints,SAM2_guided.images: Path to the directory containing input images.
Optional (General)
ground_truth: Path to ground truth masks. Required if usingdynamicstrategies or for evaluation.num_points: Total point budget per image (default: 30).color_dict: Path to JSON file mapping colors to class IDs (essential for RGB GTs).default-background-class-id: Integer ID to use for the background class (default: 0).maskSLIC: Set toTrueto enable MaskSLIC superpixel refinement.visualizations: Set toTrueto save overlay images for debugging.
Optional (Strategy Specific)
lambda_balance: (Dynamic only) Float [0-1]. Higher values favor exploitation (coverage).heatmap_fraction: (Dynamic only) Float [0-1]. Ratio of points sampled from uncertainty heatmap.strategy_kwargs: A dictionary of extra parameters specific to the chosen strategy (e.g.,{"propagation_overlap_policy": "last"}).
Debugging
debug_expanded_masks: Set toTrueto save individual SAM2 expansion steps.
Discuss with your supervisor the license that you want to set and include the licenses of any previous repo in which your code was inspired.
@article{borja2025sparseuwseg,
title={SparseUWSeg: Active Sparse Point-Label Augmentation for Underwater Semantic Segmentation},
author={Borja, C{\'e}sar and Plou, Carlos and Martinez-Cant{\'\i}n, Rub{\'e}n and Murillo, Ana C},
journal={arXiv preprint arXiv:2510.10163},
year={2025}
}This work was supported by a DGA scholarship and by DGA project T45_23R, and grants AIA2025-163563-C31, PID2024-159284NB-I00, PID2021-125514NB-I00 and PID2024-158322OB-I00 funded by MCIN/AEI/10.13039/501100011033 and ERDF.
