From 32a9661b4eb92cfd0c6f74e7223fdf8b036b868e Mon Sep 17 00:00:00 2001
From: Patrick Esser <Patrick.Esser@gmx.net>
Date: Tue, 21 Dec 2021 11:35:45 +0000
Subject: [PATCH] add inpainting model

---
 README.md                  | 17 +++++++++++++++--
 scripts/download_models.sh |  7 ++-----
 2 files changed, 17 insertions(+), 7 deletions(-)

diff --git a/README.md b/README.md
index 2a4ebec..1d3ec72 100644
--- a/README.md
+++ b/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
diff --git a/scripts/download_models.sh b/scripts/download_models.sh
index aef01ea..a6e74de 100644
--- a/scripts/download_models.sh
+++ b/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 ../..
\ No newline at end of file
+cd ../..
-- 
GitLab