Views
No views yet

1conda create -n dsp python=3.10.20
2conda activate dsp
3pip install torch==2.6.0 torchvision==0.21.0 torchaudio==2.6.0 --index-url https://download.pytorch.org/whl/cu126
4pip install datasets==4.8.5 pillow==12.2.0 accelerate==1.13.0 transformers==5.8.1 diffusers==0.38.0 safetensors==0.8.0rc0 tensorboard==2.20.0 opencv-python==4.13.0.92 einops==0.8.2 imagesize==2.0.0 peft==0.19.1 ttach==0.0.3 ftfy==6.3.1 albumentations==2.0.81conda create -n dsp-eval python=3.10.20
2conda activate dsp-eval
3conda install mkl==2023.1.0 numpy==1.26.4
4conda install pytorch==2.1.2 torchvision==0.16.2 torchaudio==2.1.2 pytorch-cuda=12.1 -c pytorch -c nvidia
5pip install mmengine==0.10.7 tqdm==4.67.3 shapely==2.1.2 scipy==1.15.3 terminaltables==3.1.10 ultralytics==8.4.50 pycocotools==2.0.11 https://download.openmmlab.com/mmcv/dist/cu121/torch2.1.0/mmcv-2.1.0-cp310-cp310-manylinux1_x86_64.whl "numpy<2.0.0" "setuptools<70.0.0"export DSP_PROJECT_DIR=/path/to/DSP # replace with the actual path~/.bashrc or ~/.zshrc for persistence../pretrained as follows:1pretrained
2├── stable-diffusion-v1-5
3│ └── ...
4├── clip-vit-large-patch14
5│ └── ...
6├── dinov2_vitl14_pretrain.pth
7└── ViT-B-16.pt1ln -s /path/to/stable-diffusion-v1-5 ./pretrained/stable-diffusion-v1-5
2ln -s /path/to/clip-vit-large-patch14 ./pretrained/clip-vit-large-patch14
3ln -s /path/to/dinov2_vitl14_pretrain.pth ./pretrained/dinov2_vitl14_pretrain.pth
4ln -s /path/to/ViT-B-16.pt ./pretrained/ViT-B-16.pt1DIOR-VOC
2├── Annotations
3│ ├── Horizontal_Bounding_Boxes
4│ └── Oriented_Bounding_Boxes
5└── VOC2007
6 ├── ImageSets
7 │ ├── Layout
8 │ ├── Main
9 │ └── Segmentation
10 └── JPEGImages1RUOD
2├── Environment_pic
3│ ├── blur
4│ ├── color
5│ └── light
6├── Environmet_ANN
7├── RUOD_ANN
8└── RUOD_pic
9 ├── test
10 └── train1ExDark
2├── annos
3├── imageclasslist.txt
4└── images./scripts/data_process, after updating all hard-coded paths (e.g., /path/to/DIOR_VOC, /path/to/RUOD, /path/to/ExDark) in the scripts to match the local setup. Execute them in order../data with the following structure:1data
2├── DIOR
3│ ├── dior_emb.pt
4│ ├── images -> /path/to/DIOR-VOC/VOC2007/JPEGImages
5│ ├── metadatas
6│ └── patches
7├── EXDARK
8│ ├── exdark_emb.pt
9│ ├── images
10│ ├── metadatas
11│ └── patches
12└── RUOD
13 ├── images -> /path/to/RUOD/RUOD_pic
14 ├── metadatas
15 ├── patches
16 └── ruod_emb.pt./configs: dsp-dior.yaml, dsp-ruod.yaml, and dsp-exdark.yaml.Argument Description:
- config: configuration file for model and dataset setup.
- metaseed: seed generator identifier for deterministic sampling.
- num_seed: number of sampling seeds for few-shot evaluation.
- k_shot: number of samples per category in few-shot setting.
- run_id: identifier for different runs.
- gpu_ids: GPU device indices for execution.
- iter: number of bootstrap iterations for FID.
1bash train_base.sh --config "dsp-dior"
2bash train_base.sh --config "dsp-ruod"
3bash train_base.sh --config "dsp-exdark"1bash train_novel.sh --config "dsp-dior" --metaseed "aaa" --num_seed 50 --k_shot "5" --run_id "1" --gpu_ids "0,1,2,3"
2bash train_novel.sh --config "dsp-ruod" --metaseed "aaa" --num_seed 50 --k_shot "5" --run_id "1" --gpu_ids "0,1,2,3"
3bash train_novel.sh --config "dsp-exdark" --metaseed "aaa" --num_seed 50 --k_shot "5" --run_id "1" --gpu_ids "0,1,2,3"1bash infer.sh --config "dsp-dior" --metaseed "aaa" --num_seed 50 --k_shot "5" --run_id "1" --ckpt "100" --gpu_ids "0,1,2,3" --max_infer_size 50
2bash infer.sh --config "dsp-ruod" --metaseed "aaa" --num_seed 50 --k_shot "5" --run_id "1" --ckpt "100" --gpu_ids "0,1,2,3" --max_infer_size 50
3bash infer.sh --config "dsp-exdark" --metaseed "aaa" --num_seed 50 --k_shot "5" --run_id "1" --ckpt "100" --gpu_ids "0,1,2,3" --max_infer_size 50./pretrained. The expected directory structure is as follows:1pretrained
2├── evaluation
3│ ├── mmdet
4│ │ ├── faster_rcnn_r50_fpn_1x-dior
5│ │ │ └── epoch_12.pth
6│ │ ├── faster_rcnn_r50_fpn_1x-exdark
7│ │ │ └── epoch_12.pth
8│ │ └── faster_rcnn_r50_fpn_1x-ruod
9│ │ └── epoch_12.pth
10│ └── yolo
11│ └── best.pt
12└── ... (pretrained models for training)Note: In yolo-wrapper-dior.sh, the--xml_folderpath should be set to the DIOR annotation directory (/path/to/DIOR-VOC/Annotations/Horizontal_Bounding_Boxes).
1cd $DSP_PROJECT_DIR/scripts/evaluation/yoloscore-dior
2bash yolo-wrapper-dior.sh --config "dsp-dior" --metaseed "aaa" --num_seed 50 --ckpt "100" --k_shot "5" --run_id "1" --gpu_ids 01cd $DSP_PROJECT_DIR/scripts/evaluation/FasterRCNN_score-mmdet
2bash test-wrapper-dior.sh --config "dsp-dior" --metaseed "aaa" --num_seed 50 --ckpt "100" --k_shot "5" --run_id "1" --gpu_ids 0
3bash test-wrapper-ruod.sh --config "dsp-ruod" --metaseed "aaa" --num_seed 50 --ckpt "100" --k_shot "5" --run_id "1" --gpu_ids 0
4bash test-wrapper-exdark.sh --config "dsp-exdark" --metaseed "aaa" --num_seed 50 --ckpt "100" --k_shot "5" --run_id "1" --gpu_ids 01cd $DSP_PROJECT_DIR/scripts/evaluation/bootstrap_fid
2python boot_fid-dior.py --config dsp-dior -run_id 1 -num_seeds 50 --iter 50 --k_shot 5
3python boot_fid-ruod.py --config dsp-ruod -run_id 1 -num_seeds 50 --iter 50 --k_shot 5
4python boot_fid-exdark.py --config dsp-exdark -run_id 1 -num_seeds 50 --iter 50 --k_shot 5./metrics/BootstrapFID.1cd $DSP_PROJECT_DIR/scripts/evaluation/summarize
2bash summarize-wrapper.sh --config "dsp-dior" --k_shot "5" --run_id "1" --ckpt "100" --metaseed "aaa" --num_seed 50
3bash summarize-wrapper.sh --config "dsp-ruod" --k_shot "5" --run_id "1" --ckpt "100" --metaseed "aaa" --num_seed 50
4bash summarize-wrapper.sh --config "dsp-exdark" --k_shot "5" --run_id "1" --ckpt "100" --metaseed "aaa" --num_seed 50./metrics.1@inproceedings{
2 bao2026envisioning,
3 title={Envisioning Beyond the Few: Disentangled Semantics and Primitives for Few-Shot Atypical Layout-to-Image Generation},
4 author={Bao, Nan and Zhao, Yifan and Wang, Wenzhuang and Li, Jia},
5 booktitle={Forty-third International Conference on Machine Learning},
6 year={2026},
7 url={https://openreview.net/forum?id=Jva4wVEySO}
8}