Quickstart¶
This step-by-step guide walks you from a fresh checkout to a successful run of VISWIR. Follow the steps in order; optional paths (container/HPC) are clearly marked.
Prerequisites¶
OS: Linux (recommended) or Windows (developed on), not tested on macOS
Python: 3.10+ installed and on PATH
Git: installed
Disk space: ~3-5 GB (datasets + container optional)
Optional: Singularity/Apptainer (for container), SLURM (for HPC)
Note
If you plan to use TIFF images, you’ll need the Python package imagecodecs.
Step 1 - Get the source¶
Clone the repository:
git clone https://github.com/comsee-research/viswir.git cd viswir
Inspect the layout (optional):
ls -1 # README.md, HELP.md, src/, config/, data/, tools/, results/, requirements.txt ...
Step 2 - Choose your environment¶
A. Local Python (virtualenv)¶
Install packages (script provided):
chmod +x install_packages_venv.sh ./install_packages_venv.sh
If you use TIFF images:
pip install imagecodecs
Note
You can also install manually with pip install -r requirements.txt.
In this case, first create a virtualenv and activate it:
python -m venv .venv
source .venv/bin/activate
B. Container (Singularity/Apptainer)¶
Build the container (CPU-only example):
cd tools sudo singularity build VISWIR.sif Singularity
The Singularity build file is available in the
toolsfolder.
Important
To use Singularity, you must be running Linux or WSL2 for Windows (tested via WSL2 with Debian). See the Singularity user guide.
Confirm it runs:
singularity exec VISWIR.sif python -V
Tip
Full container instructions are available in Help for Singularity and Running VISWIR on HPC with SLURM.
Step 3 - Prepare your data¶
Create a minimal dataset structure:
mkdir -p data/visible data/swir results cp path/to/your/visible_images/*.png data/visible/ cp path/to/your/swir_images/*.png data/swir/
Ensure filenames are paired consistently:
Example:
data/visible/img_001.pngmatchesdata/swir/img_001.png.
Optional detection annotations:
Add XML files in
data/ground_truth/if you plan to run detection.
Warning
Misaligned pairs produce invalid fusion. Always verify filenames match
across visible/ and swir/.
Step 4 - Configure the run¶
Edit
config/config_viswir.yaml: - Paths:visible_folder,swir_folder,output_folder- Mode:sql(recommended),optuna, orfixed(legacy) - Optional:ref_image_path,ground_truth_path,run_detection,save_outputFusion parameters: -
parameters.json(SQL/fixed modes) -fast_config.yaml(fast mode)Detection (optional): -
yolo_config.json(weights, thresholds, classes, device)
Tip
Start simple—disable detection and enable save_output to validate the pipeline first.
Step 5 - First execution¶
Fast mode (quick smoke test)¶
python src/VISWIR_vQuasar.py --fast \
--visible ./data/visible/img_001.png \
--swir ./data/swir/img_001.png \
--out ./results/fused_img_001.png
Note
Fast mode skips metric computation. Use it for rapid prototyping, not for final evaluation.
SQL mode (recommended full run)¶
# In config_viswir.yaml: mode: "sql"
python src/VISWIR_vQuasar.py
Optuna mode (hyperparameter optimization)¶
# In config_viswir.yaml: mode: "optuna"
python src/VISWIR_vQuasar.py
Tip
Start with fewer trials (10-20) to validate everything, then scale up.
Step 6 - Running with container¶
Fast test inside container:
singularity run VISWIR.sif --fast \
--visible /VISWIR/data/visible/img_001.png \
--swir /VISWIR/data/swir/img_001.png \
--out /VISWIR/results/fused_img_001.png
Bind host directories:
singularity run \
-B $(pwd)/results:/VISWIR/results \
-B $(pwd)/src/logs:/VISWIR/src/logs \
-B $(pwd)/config:/VISWIR/config \
-B $(pwd)/data:/VISWIR/data \
VISWIR.sif
Step 7 - Optional: HPC (SLURM) submission¶
Pick a script in
tools/: -job_viswir_test.slurm(quick test) -job_viswir.slurm(standard) -job_viswir_ex.slurm(custom resources)Submit:
sbatch tools/job_viswir.slurmMonitor:
squeue -u $USER scontrol show job <job_id> seff <job_id>
Important
Adjust --mem, --cpus-per-task, and --time to match your quota
and dataset size.
Step 8 - Verify outputs and logs¶
Images: check
results/for fused outputs.Database: inspect
results/results.dbwithtools/sql_explorer.py.Logs: review
src/logs/for warnings or errors.
Note
Any errors related to input data (different sizes, unequal number of visible and SWIR images, etc.) will cause a fatal error in code execution. Errors that cause the code to crash will be displayed in your terminal.
Step 9 - Common issues and quick fixes¶
Missing TIFF support →
pip install imagecodecsNo fused image in fast mode → check
--outpathSQL run persists but no metrics → confirm
save_outputand dataset pathsDetection crashes → check
yolo_config.jsonand trydevice: "cpu"Container path issues → verify
-Bbindings and internal paths
Step 10 - Next steps¶
Explore configuration details: see Configuration Files
Prepare larger datasets: see Datasets
Use tools for analysis and export: see Tools
Run at scale on HPC: see Running VISWIR on HPC with SLURM
Tip
Once your pipeline is stable in SQL mode, move to Optuna to tune parameters and maximize metric performance for your dataset.