Browse Source

add inpainting model

Patrick Esser 4 years ago
parent
commit
32a9661b4e
2 changed files with 17 additions and 7 deletions
  1. 15 2
      README.md
  2. 2 5
      scripts/download_models.sh

+ 15 - 2
README.md

@@ -70,10 +70,23 @@ We provide a first script for sampling from our unconditional models. Start it v
 CUDA_VISIBLE_DEVICES=<GPU_ID> python scripts/sample_diffusion.py -r models/ldm/<model_spec>/model.ckpt -l <logdir> -n <\#samples> --batch_size <batch_size> -c <\#ddim steps> -e <\#eta> 
 ```
 
-## Coming Soon...
-
+# Inpainting
 ![inpainting](assets/inpainting.png)
 
+Download the pre-trained weights
+```
+wget -O models/ldm/inpainting_big/last.ckpt https://heibox.uni-heidelberg.de/f/4d9ac7ea40c64582b7c9/?dl=1
+```
+
+and sample with
+```
+python scripts/inpaint.py --indir data/inpainting_examples/ --outdir outputs/inpainting_results
+```
+`indir` should contain images `*.png` and masks `<image_fname>_mask.png` like
+the examples provided in `data/inpainting_examples`.
+
+## Coming Soon...
+
 * Code for training LDMs and the corresponding compression models.
 * Inference scripts for conditional LDMs for various conditioning modalities.
 * In the meantime, you can play with our colab notebook https://colab.research.google.com/drive/1xqzUi2iXQXDqXBHQGP9Mqt2YrYW6cx-J?usp=sharing

+ 2 - 5
scripts/download_models.sh

@@ -8,7 +8,7 @@ wget -O models/ldm/cin256/model.zip https://ommer-lab.com/files/latent-diffusion
 wget -O models/ldm/semantic_synthesis512/model.zip https://ommer-lab.com/files/latent-diffusion/semantic_synthesis.zip
 wget -O models/ldm/bsr_sr/model.zip https://ommer-lab.com/files/latent-diffusion/sr_bsr.zip
 wget -O models/ldm/layout2img-openimages256/model.zip https://ommer-lab.com/files/latent-diffusion/layout2img_model.zip
-wget -O models/ldm/inpainting_big/model.zip #TODO @patrick add path
+wget -O models/ldm/inpainting_big/last.ckpt https://heibox.uni-heidelberg.de/f/4d9ac7ea40c64582b7c9/?dl=1
 
 
 
@@ -39,7 +39,4 @@ unzip -o model.zip
 cd ../layout2img-openimages256
 unzip -o model.zip
 
-cd ../inpainting_big
-unzip -o model.zip
-
-cd ../..
+cd ../..