Awesome
CamoDiffusion
This repository is the official implementation of CamoDiffusion: Camouflaged Object Detection via Conditional Diffusion Models.
Our implementation is based on the denoising diffusion repository from <a href="https://github.com/lucidrains/denoising-diffusion-pytorch">lucidrains</a>, which is a PyTorch implementation of <a href="https://arxiv.org/abs/2006.11239">DDPM</a>.
And we provide our pretrained weight and inference result in release.
Requirements
- python == 3.9
- cuda == 11.3
To install requirements:
pip install -r requirements.txt
Dataset
COD (Camouflaged Object Detection) Dataset
Training
To train the model(s) in the paper, run this command:
accelerate launch train.py --config config/camoDiffusion_352x352.yaml --num_epoch=150 --batch_size=32 --gradient_accumulate_every=1
And then finetune it to 384 size:
accelerate launch train.py --config config/camoDiffusion_384x384.yaml --num_epoch=20 --batch_size=28 --gradient_accumulate_every=1 --pretrained model_352/model-best.pt --lr_min=0 --set optimizer.params.lr=1e-5
Evaluation
To test a model, run sample.py with the desired model on different datasets:
accelerate launch sample.py \
--config config/camoDiffusion_384x384.yaml \
--results_folder ${RESULT_SAVE_PATH} \
--checkpoint ${CHECKPOINT_PATH} \
--num_sample_steps 10 \
--target_dataset CAMO \
--time_ensemble
For ease of use, we create a eval.sh script and a use case in the form of a shell script eval.sh. You can edit the script to change the parameters you want to test.
bash scripts/eval.sh
Citation
@article{chen2023camodiffusion,
title={CamoDiffusion: Camouflaged Object Detection via Conditional Diffusion Models},
author={Chen, Zhongxi and Sun, Ke and Lin, Xianming and Ji, Rongrong},
journal={arXiv preprint arXiv:2305.17932},
year={2023}
}