MCPcopy Index your code
hub / github.com/Nithin-GK/T2V-DDPM

github.com/Nithin-GK/T2V-DDPM @main

Chat with this repo
repository ↗ · DeepWiki ↗ · + Follow
270 symbols 694 edges 21 files 100 documented · 37%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

[IEEE FG'23] T2V-DDPM: Thermal to Visible Face Translation using Denoising Diffusion Probabilistic Models

Paper link

Modern-day surveillance systems perform person recognition using deep learning-based face verification networks. Most state-of-the-art facial verification systems are trained using visible spectrum images. But, acquiring images in the visible spectrum is impractical in scenarios of low-light and nighttime conditions, and often images are captured in an alternate domain such as the thermal infrared domain. Facial verification in thermal images is often performed after retrieving the corresponding visible domain images. This is a well-established problem often known as the Thermal-to-Visible (T2V) image translation. In this paper, we propose a Denoising Diffusion Probabilistic Model (DDPM) based solution for T2V translation specifically for facial images. During training, the model learns the conditional distribution of visible facial images given their corresponding thermal image through the diffusion process. During inference, the visible domain image is obtained by starting from Gaussian noise and performing denoising repeatedly. The existing inference process for DDPMs is stochastic and time-consuming. Hence, we propose a novel inference strategy for speeding up the inference time of DDPMs, specifically for the problem of T2V image translation. We achieve the state-of-the-art results on multiple datasets.

Prerequisites:

  1. Create a conda environment and activate using
conda env create -f environment.yml
conda activate T2V-diff

Data Preparation

  1. Prepare Data in the following format
    ├── data 
    |   ├── train # Training  
    |   |   ├── TH              # thermal images 
    |   |   └── VIS             # visible images
    |   └── test  # Testing
    |       ├── TH              # thermal images 
    |       ├── sample.png      # one visible sample from training set to take colour bit from
  1. Preprocess the testdata using:
python preprocess_test.py

Training and Testing

  1. Run following commands to train and test
For training:
export PYTHONPATH=$PYTHONPATH:$(pwd)
CUDA_VISIBLE_DEVICES="0" NCCL_P2P_DISABLE=1  torchrun --nproc_per_node=1 --master_port=4326 scripts/T2V_train.py 

For testing:
export PYTHONPATH=$PYTHONPATH:$(pwd)
CUDA_VISIBLE_DEVICES="0" NCCL_P2P_DISABLE=1  torchrun --nproc_per_node=1 --master_port=4326 scripts/T2V_test.py --weights /pathtoweights/ --data_dir /pathtodata/

Model weights

The weights for THVIS dataset can be found in THVIS weights

The weights for ARL-VTF dataset can be found in ARL-VTF weights

Citation

  1. If you use our work, please use the following citation
@article{nair2022t2v,
  title={T2V-DDPM: Thermal to Visible Face Translation using Denoising Diffusion Probabilistic Models},
  author={Nair, Nithin Gopalakrishnan and Patel, Vishal M},
  journal={arXiv preprint arXiv:2209.08814},
  year={2022}
}

Acknowledgements

Thanks to authors of Diffusion Models Beat GANs on Image Synthesis sharing their code. Most of the code is borrowed from the guided diffusion

https://github.com/openai/guided-diffusion

Core symbols most depended-on inside this repo

_extract_into_tensor
called by 25
guided_diffusion/gaussian_diffusion.py
log
called by 24
guided_diffusion/logger.py
conv_nd
called by 12
guided_diffusion/nn.py
get_current
called by 9
guided_diffusion/logger.py
logkv_mean
called by 8
guided_diffusion/logger.py
mean_flat
called by 6
guided_diffusion/nn.py
log
called by 6
guided_diffusion/logger.py
close
called by 6
guided_diffusion/logger.py

Shape

Method 136
Function 96
Class 38

Languages

Python100%

Modules by API surface

guided_diffusion/logger.py59 symbols
guided_diffusion/unet.py38 symbols
guided_diffusion/gaussian_diffusion.py31 symbols
guided_diffusion/fp16_util.py23 symbols
guided_diffusion/nn.py17 symbols
guided_diffusion/resample.py15 symbols
guided_diffusion/train_util.py14 symbols
guided_diffusion/respace.py10 symbols
guided_diffusion/image_datasets.py10 symbols
guided_diffusion/script_util.py9 symbols
core/wandb_logger.py8 symbols
core/logger.py8 symbols

For agents

$ claude mcp add T2V-DDPM \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact