This repository contains the code for training and sampling from a Denoising Diffusion Implicit Model (DDIM) for LArTPC Image Generation.
DDIMs are a non-Markovian, deterministic version of DDPMs (Diffusion Probabilistic Models) that can produce samples much quicker than DDPMs. DDPMs have been shown to be directly related to score-based models, so you should expect similar performance to the score-based models in the paper Score-based Diffusion Models for Generating Liquid Argon Time Projection Chamber Images.
DDIM paper: Denoising Diffusion Implicit Models
python download_lartpc_dataset.py --exp {PROJECT_PATH}
where
PROJECT_PATH
is the path to the experiment directory, where you will create a subdirectory for this experiment. All files will be saved in this directory.
This will download the dataset of 64x64 cropped LArTPC images used in Score-based Diffusion Models for Generating Liquid Argon Time Projection Chamber Images, which is found on Zenodo and was derived from the PILArNet dataset. See the paper for more details on this dataset.
Training is exactly the same as DDPM with the following:
python main.py --config lartpc.yml --exp {PROJECT_PATH} --doc {RUN_NAME}
where
RUN_NAME
is the name of the run.
This will create 8 sample images from the model.
python main.py --config lartpc.yml --exp {PROJECT_PATH} --doc {MODEL_NAME} --sample --timesteps {STEPS} --eta {ETA}
where
ETA
controls the scale of the variance (0 is DDIM, and 1 is one type of DDPM).STEPS
controls how many timesteps used in the process. The model is trained on 1000 steps, so 1000 is a good starting point.MODEL_NAME
finds the pre-trained checkpoint according to its inferred path.
Use --sequence
option instead.
The above two cases contain some hard-coded lines specific to producing the image, so modify them according to your needs.
This implementation is based on:
- https://github.com/ermongroup/ddim (the DDIM repo),
- https://arxiv.org/abs/2307.13687 (the score-based diffusion for LArTPC images paper).