This repository contains the code and datasets accompanying the paper "Enhancing Perception through Visible and SWIR Image Fusion in Harsh Environments" by Alexandre Riffard, Mathieu Labussière, Pierre Duthon, and Romuald Aufrère. The paper introduces VISWIR, an image fusion method that combines Visible and Short Wave Infrared (SWIR) spectra to enhance the perception capabilities of autonomous vehicles in harsh environmental conditions.
- Introduction
- Features
- Visuals
- Getting Started
- Usage
- Dataset
- Contributing
- License
- Authors and acknowledgment
- Contact
- Image Fusion: Combines visible and SWIR images to improve visibility and obstacle detection in fog, rain, and smoke.
- Weight Map Generation: Uses weight maps to optimize the fusion process.
- Pyramid Fusion: Integrates images at multiple scales for superior image quality.
- Post-processing: Enhances visual quality and detail in fused images.
Demo of the solution:
Before installing VISWIR, make sure your system has:
- Python 3.11.x (tested with 3.10.11, recommended 3.11.2 for containers)
- pip (Python package installer, comes with Python β₯β―3.4)
- virtualenv / venv (recommended for local installation)
- Git (to clone the repository)
- System libraries (needed for OpenCV, imagecodecs, etc.)
- Linux (Debian/Ubuntu):
sudo apt-get update && sudo apt-get install -y \ build-essential wget curl git \ libgl1 libglib2.0-0 libxrender1 \ zlib1g-dev libffi-dev libssl-dev \ libsqlite3-dev libbz2-dev liblzma-dev \ libreadline-dev libncurses5-dev libgdbm-dev
- Linux (Debian/Ubuntu):
Development environment:
- Python 3.11.2 (also tested with 3.10.2)
- PyTorch 2.x (compiled with CUDA 12.1)
- CUDA Toolkit 12.2 (nvcc)
- NVIDIA Driver supporting CUDA 13.0
- OS: Windows 11 (development), WSL2 Debian (validation)
Optional (depending on usage):
- NVIDIA GPU drivers + CUDA/cuDNN if you want to run PyTorch in GPU mode locally.
(β οΈ In the container build, only CPU wheels are installed by default.)
β The code has been developed and tested on:
- Windows 11 (development environment)
- WSL2 (Debian) for Linux validation
- Singularity container (CPUβonly) for reproducible runs
- HPC2 cluster at MΓ©socentre Clermont Auvergne
HPC2 environment details:
- OS: Linux
- Job scheduler: SLURM
VISWIR has been successfully executed on HPC2 for largeβscale optimization tasks (Optuna mode), leveraging highβmemory partitions.
-
Clone the repository:
git clone https://github.com/comsee-research/viswir.git cd viswir -
Install the required Python packages:
Option A β Local installation with virtualenv
chmod +x install_packages_venv.sh ./install_packages_venv.sh
Option B β Inside the container
Dependencies are installed automatically viainstall_packages_container.shduring the Singularity build. How to build (CPU only) --> HELP.md (en) - HELP_fr.md (fr)
VISWIR can be run in several modes, depending on your needs:
- SQL mode (recommended): runs the fusion process using parameters defined in
parameters.jsonon an entire folder, and saves the results (metrics + images if requested) in a SQLite database. - Optuna mode: automatically performs hyperparameter optimization for the fusion process using Optuna.
- Fast mode (--fast): ultra-light pipeline for quickly testing a single image pair (fusion + optional detection), without metric computation or database recording.
- Fixed mode: legacy mode, deprecated (but same as SQL).
-
config_viswir.yamlGeneral control parameters:visible_folder,swir_folder,output_folder: data paths.ref_image_path: reference image (for R-IQA).ground_truth_path: detection annotations.mode:"fixed","sql", or"optuna".run_detection: enables/disables YOLO detection.save_output: toggles saving of fused images.
-
parameters.jsonFusion parameters used in Fixed and SQL modes (facteur_swir,beta,level,apply_gamma,gamma_value).mode_fixeis a legacy field and should not be modified. -
fast_config.yamlMinimal configuration for the fast pipeline:run_detection: enables/disables detection.facteur_swir,beta,level,apply_gamma,gamma_value.
-
logger_config.yamlLogging system configuration (level, console/file output, format, rotation). -
optuna_config.yamlOptuna optimization parameters (number of trials, parallel jobs, pruner, timeout, etc.). -
optuna_search_space.yamlDefinition of the search space for Optuna (ranges and types of hyperparameters). -
yolo_config.jsonYOLO model parameters for detection (weights, thresholds, device, allowed classes).
python VISWIR_vQuasar.py# In config_viswir.yaml: mode: "sql"
python VISWIR_vQuasar.py# In config_viswir.yaml: mode: "optuna"
python VISWIR_vQuasar.pypython VISWIR_vQuasar.py --fast \
--visible ../data/vis.jpg \
--swir ../data/swir.png \
--out ../results/fused.png- Use
fast_config.yamlfor fusion parameters. - Use
yolo_config.jsonifrun_detection: true. - Does not compute metrics β only saves the final output.
singularity run VISWIR_ex.sif --fast \
--visible /VISWIR/data/vis.jpg \
--swir /VISWIR/data/swir.png \
--out /VISWIR/results/fused.pngMore info in HELP.md and HELP_fr.md (french translation). Singularity build file availaible here.
/VISWIR
βββ config/ (Configuration files)
βββ data/ (Input datasets)
βββ results/ (Processing results)
βββ msc/ (Funding, HPC logos, and SOTA comparison scripts)
β βββ other/ (Unofficial SOTA re-implementations)
β βββ README.md # References & disclaimer for unofficial code
β βββ Top-Hat.py # Re-implementation of Top-Hat transform (Herrera-Arellano et al., 2021)
β βββ V-SWIR-IF.py # Re-implementation of V-SWIR-IF (Fang et al., 2023)
βββ src/ (Main source code)
β βββ VISWIR_vQuasar.py # Main entry point
β βββ logs/ # Log files
β β
β βββ fusion/ # Scientific core
β β βββ NIQE/ # NIQE implementation
β β β βββ *.mat # Matlab files for NIQE
β β β βββ niqe.py # NIQE computation
β β βββ fusion.py # Main fusion functions
β β βββ functions.py # Direct support functions
β β βββ metrics.py # Metrics computation (SSIM, NIQE, etc.)
β β βββ detection_module.py # Detection (YOLO + F1)
β β βββ utils.py # Utilities (I/O, normalization, etc.)
β β
β βββ processing/ # Batch/SQL orchestration
β β βββ batch_runner.py # Batch processing
β β βββ sql_runner.py # SQL processing
β β βββ task_manager.py # Task management
β β βββ interruption.py # Interruption handling
β β
β βββ optimization/ # Optimization (Optuna, HPC)
β β βββ optuna_runner.py # Main Optuna loop
β β βββ objective.py # Objective functions
β β βββ visualization.py # Result visualization
β β βββ samplers.py # Sampler/pruner configuration
β β
β βββ realtime/
β β βββ fast_fusion_runner.py # Fast pipeline
β β βββ fast_config.py # Fast configuration
β β βββ fast_detection.py # Fast detection
β β
β βββ common/ # Shared modules
β β βββ logger.py # Centralized logging
β β βββ ui.py # Terminal display
β β βββ results_db.py # Database connection and saving
β β βββ config_loader.py # YAML/JSON loader
β β βββ datatypes.py # Dataclasses (ProcessResult, Config, etc.)
β
βββ test/ (Test scripts)
βββ tools/ (Utilities and SQL)
β
βββ HELP.md (Singularity guide)
βββ HELP_fr.md (Singularity guide but in french)
βββ install_packages_venv.sh (Local installation via venv)
βββ install_packages_container.sh (Container installation)
βββ LICENSE.txt (Project license)
βββ README.md (Project overview)
βββ requirements.txt (List of Python dependencies)
The dataset used in this paper is available upon request. Please contact the authors for access.
This project is licensed under the GNU Lesser General Public License 3.0 - see the LICENSE file for details.
Riffard Alexandre (1), Mathieu Labussière (1), Pierre Duthon (2), Romuald Aufrère (1)
(1) UniversitΓ© Clermont Auvergne, Clermont Auvergne INP, CNRS, Institut Pascal, F-63000 Clermont-Ferrand, France
(2) Cerema, Research Team βIntelligent Transport Systemsβ, 8-10 Rue Bernard Palissy, CEDEX 2, F-63017 Clermont-Ferrand, France
This work was supported by the International Research Center ''Innovation Transportation and Production Systems'' of the I-SITE CAP 20-25.
This work was granted access to the HPC resources of the MΓ©socentre Clermont Auvergne (cluster HPC2) of the UniversitΓ© Clermont Auvergne (France).
We gratefully acknowledge the support of the MΓ©socentre team for providing computational resources and assistance.
For any questions or inquiries, please contact Alexandre Riffard.
If you use this code in your project, please consider citing the following papers:
- VISWIR:
@Article{s26134035, AUTHOR = {Riffard, Alexandre and Labussière, Mathieu and Duthon, Pierre and Aufrère, Romuald}, TITLE = {Enhancing Perception Through Context-Adaptive Visible and SWIR Image Fusion in Harsh Environments}, JOURNAL = {Sensors}, VOLUME = {26}, YEAR = {2026}, NUMBER = {13}, ARTICLE-NUMBER = {4035}, URL = {https://www.mdpi.com/1424-8220/26/13/4035}, PubMedID = {42451277}, ISSN = {1424-8220}, DOI = {10.3390/s26134035} }
- Dataset:
@inproceedings{riffard2024exploitation, title={Exploitation d'un capteur proche infrarouge (SWIR) pour la perception des robots mobiles en conditions m{\'e}t{\'e}orologiques difficiles}, author={Riffard, Alexandre and Labussi{\`e}re, Mathieu and Duthon, Pierre and Aufr{\`e}re, Romuald}, booktitle={Reconnaissance des Formes, Image, Apprentissage et Perception (RFIAP'24)}, year={2024}}



