Skip to content

Sooplex/Controllable-Inpainting

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

参考了 T2I-Adapter: Learning Adapters to Dig out More Controllable Ability for Text-to-Image Diffusion Models
https://github.com/TencentARC/T2I-Adapter/tree/SD**基础上实现了Inpainting Adapter的训练。 参考https://github.com/advimman/lama**

生成随机mask

python Lama_mask/gen_mask_dataset.py Lama_mask/configs/data_gen/random_medium_512.yaml [/path/to/dataset/dir] [outdir] --n-jobs 1 --ext png

训练

export RANK=0 WORLD_SIZE=1 MASTER_ADDR="127.0.0.1" MASTER_PORT=1234
python train_inpaint.py --ckpt [path_to_sdckpt] \
            --gpus "[0]"\
            --name inpaint_v1\
            --auto_resume \
            --num_workers 0

测试

python test_inpaint.py \
--cond_path [path_to_origin] \
--mask [path_to_mask] \
--prompt "" \
--sd_ckpt [path_to_sdckpt] \
--resize_short_edge 512 --cond_tau 1.0 --cond_weight 1.0 --n_samples 2 \
--adapter_ckpt ./experiments/inpaintv1/[xxxx].pth \
--scale 9 \
--seed 42

控制Adapter

组合Inpainting Adapter和Control Adapter,可实现对inpainting的进一步控制。 期望Control Adapter需要对遥感图像等特定类别图像的生成进行控制,因此无法采用一般自然图像上训练的Adapter,需要训练针对遥感图像的adapter。
训练过程和基本的T2i-Adapter一致。 condition
inpaint效果

其他说明

对于遥感图像而言,在batchsize为16的情况下,需要大概7000steps的训练 遥感图像的inpainting,基础效果如下: condition
inpaint效果

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages