SAMDiffusion: Semantic Segmentation with Diffusion Model and Segmentation Anything Model
conda create -n SAMDiffusion python=3.8
conda activate SAMDiffusion
install pydensecrf https://github.com/lucasb-eyer/pydensecrf
pip install git+https://github.com/lucasb-eyer/pydensecrf.git
pip install -r requirements.txt
Refer to facebookresearch/sam2 for the recommended folder structure.
Place the sam2
folder in the project directory, prepare the model files, and organize them as follows:
.
├── SAMDiffusion
│ ├── sam2_optimization.py
│ ├── sam2_optimization_multi.py
│ └── ...
└── sam2
├── checkpoints
├── configs
└── ...
# generating data and attention map witn stable diffusion (Before generating the data, you need to modify the "hunggingface key" in the "Stable_Diffusion" codes to your own key. )
sh ./generate/VOC_multiple_data_generation.sh
Following the segmentation model framework from mmsegmentation,
we adopt the standard training configuration.
We are providing synthetic data here with Baidu Drive (password: abcd). Feel free to use it.