diff --git a/gen_compare/.gitattributes b/gen_compare/.gitattributes
new file mode 100644
index 0000000000000000000000000000000000000000..01fc1bb7205b409bb8419deb75dd4872535438e0
--- /dev/null
+++ b/gen_compare/.gitattributes
@@ -0,0 +1,8 @@
+plots/figure_seg.png filter=lfs diff=lfs merge=lfs -text
+plots/figure_canny.png filter=lfs diff=lfs merge=lfs -text
+plots/figure_depth.png filter=lfs diff=lfs merge=lfs -text
+plots/figure_hed.png filter=lfs diff=lfs merge=lfs -text
+plots/figure_mlsd.png filter=lfs diff=lfs merge=lfs -text
+plots/figure_normal.png filter=lfs diff=lfs merge=lfs -text
+plots/figure_openpose.png filter=lfs diff=lfs merge=lfs -text
+plots/figure_scribble.png filter=lfs diff=lfs merge=lfs -text
diff --git a/gen_compare/README.md b/gen_compare/README.md
new file mode 100644
index 0000000000000000000000000000000000000000..e1ada951b342712a2624a1fe9b64abf42b2fa80b
--- /dev/null
+++ b/gen_compare/README.md
@@ -0,0 +1,55 @@
+# Diffusers ControlNet Impl. & Reference Impl. generated image comparison
+
+## Implementation Source Code & versions
+- Diffusers (in development version): https://github.com/takuma104/diffusers/tree/e758682c00a7d23e271fd8c9fb7a48912838045c
+- Reference Impl.: https://github.com/lllyasviel/ControlNet/tree/2f77609bf6a8a2243d9faa198365fc6222c5435f
+
+## Environment
+- OS: Ubuntu 22.04
+- GPU: Nvidia RTX3060 (12GB)
+
+## Scripts to generate plots:
+- Create control image: [create_control_images.py](create_control_images.py)
+- Diffusers generated image: [gen_diffusers_image.py](gen_diffusers_image.py)
+- Reference generated image: [gen_reference_image.py](gen_reference_image.py)
+- Create Plots: [create_plots.py](create_plots.py)
+
+## Original image for control image:
+- All images from [test_imgs](https://github.com/lllyasviel/ControlNet/test_imgs) excepts vermeer image. Croped and resized to 512x512px.
+
+
+
+
+
+
+
+
+## Generate Settings:
+#### Control Images:
+Converted above original images by [controlnet_hinter](https://github.com/takuma104/controlnet_hinter).
+
+#### Prompts:
+All images were generated with the same prompt.
+
+- Prompt: `best quality, extremely detailed, illustration, looking at viewer`
+- Negative Prompt: `monochrome, lowres, bad anatomy, worst quality, low quality`
+
+#### Ohter setting (both common):
+- sampler: DDIM
+- guidance_scale: 9.0
+- num_inference_steps: 20
+- initial random latents: created on CPU using seed
+
+## Results:
+
+[![canny](plots/figure_canny.png)](plots/figure_canny.png)
+[![depth](plots/figure_depth.png)](plots/figure_depth.png)
+[![hed](plots/figure_hed.png)](plots/figure_hed.png)
+[![mlsd](plots/figure_mlsd.png)](plots/figure_mlsd.png)
+[![normal](plots/figure_normal.png)](plots/figure_normal.png)
+[![openpose](plots/figure_openpose.png)](plots/figure_openpose.png)
+[![scribble](plots/figure_scribble.png)](plots/figure_scribble.png)
+[![seg](plots/figure_seg.png)](plots/figure_seg.png)
+
+
+
diff --git a/gen_compare/control_images/bird_512x512.png b/gen_compare/control_images/bird_512x512.png
new file mode 100644
index 0000000000000000000000000000000000000000..ff647b4bc0bb0cb198d7dcd0188686dd34c4e27d
Binary files /dev/null and b/gen_compare/control_images/bird_512x512.png differ
diff --git a/gen_compare/control_images/converted/control_bird_canny.png b/gen_compare/control_images/converted/control_bird_canny.png
new file mode 100644
index 0000000000000000000000000000000000000000..df64edde26917da92e2c3db214b15a925cc7a08b
Binary files /dev/null and b/gen_compare/control_images/converted/control_bird_canny.png differ
diff --git a/gen_compare/control_images/converted/control_bird_depth.png b/gen_compare/control_images/converted/control_bird_depth.png
new file mode 100644
index 0000000000000000000000000000000000000000..99df8135b0c659694bf7118f2e18d025e1767b79
Binary files /dev/null and b/gen_compare/control_images/converted/control_bird_depth.png differ
diff --git a/gen_compare/control_images/converted/control_bird_hed.png b/gen_compare/control_images/converted/control_bird_hed.png
new file mode 100644
index 0000000000000000000000000000000000000000..1453e6c5e62745df32b8c6faca6d360cb2b9de6b
Binary files /dev/null and b/gen_compare/control_images/converted/control_bird_hed.png differ
diff --git a/gen_compare/control_images/converted/control_bird_mlsd.png b/gen_compare/control_images/converted/control_bird_mlsd.png
new file mode 100644
index 0000000000000000000000000000000000000000..662d709dae90d0b5ad23fe846e4df7d570d6846b
Binary files /dev/null and b/gen_compare/control_images/converted/control_bird_mlsd.png differ
diff --git a/gen_compare/control_images/converted/control_bird_normal.png b/gen_compare/control_images/converted/control_bird_normal.png
new file mode 100644
index 0000000000000000000000000000000000000000..42c19b2abe735f56cda4090b1c28eba193a4f67d
Binary files /dev/null and b/gen_compare/control_images/converted/control_bird_normal.png differ
diff --git a/gen_compare/control_images/converted/control_bird_openpose.png b/gen_compare/control_images/converted/control_bird_openpose.png
new file mode 100644
index 0000000000000000000000000000000000000000..5220d0f9dbfa747cdb356761a73beb1b1f1c96bb
Binary files /dev/null and b/gen_compare/control_images/converted/control_bird_openpose.png differ
diff --git a/gen_compare/control_images/converted/control_bird_scribble.png b/gen_compare/control_images/converted/control_bird_scribble.png
new file mode 100644
index 0000000000000000000000000000000000000000..69887e91b66a8d3882d4e9b3f29e48a7a79d667e
Binary files /dev/null and b/gen_compare/control_images/converted/control_bird_scribble.png differ
diff --git a/gen_compare/control_images/converted/control_bird_seg.png b/gen_compare/control_images/converted/control_bird_seg.png
new file mode 100644
index 0000000000000000000000000000000000000000..af0e4eff4db94999ac7633e6d5918c0b3d3180ab
Binary files /dev/null and b/gen_compare/control_images/converted/control_bird_seg.png differ
diff --git a/gen_compare/control_images/converted/control_human_canny.png b/gen_compare/control_images/converted/control_human_canny.png
new file mode 100644
index 0000000000000000000000000000000000000000..d4753bcf458b81ee62f7daca434f6ffbae4f6365
Binary files /dev/null and b/gen_compare/control_images/converted/control_human_canny.png differ
diff --git a/gen_compare/control_images/converted/control_human_depth.png b/gen_compare/control_images/converted/control_human_depth.png
new file mode 100644
index 0000000000000000000000000000000000000000..705ddc92405f6819a90b6622db946201a8a9caf1
Binary files /dev/null and b/gen_compare/control_images/converted/control_human_depth.png differ
diff --git a/gen_compare/control_images/converted/control_human_hed.png b/gen_compare/control_images/converted/control_human_hed.png
new file mode 100644
index 0000000000000000000000000000000000000000..19404a341ef73cb1c91a73b01bb33827ef93d08b
Binary files /dev/null and b/gen_compare/control_images/converted/control_human_hed.png differ
diff --git a/gen_compare/control_images/converted/control_human_mlsd.png b/gen_compare/control_images/converted/control_human_mlsd.png
new file mode 100644
index 0000000000000000000000000000000000000000..119caf2bec3436f2c02de1e0efd351189e8221e2
Binary files /dev/null and b/gen_compare/control_images/converted/control_human_mlsd.png differ
diff --git a/gen_compare/control_images/converted/control_human_normal.png b/gen_compare/control_images/converted/control_human_normal.png
new file mode 100644
index 0000000000000000000000000000000000000000..82f448c14cd50d8785a243df6a2358775ddf5bba
Binary files /dev/null and b/gen_compare/control_images/converted/control_human_normal.png differ
diff --git a/gen_compare/control_images/converted/control_human_openpose.png b/gen_compare/control_images/converted/control_human_openpose.png
new file mode 100644
index 0000000000000000000000000000000000000000..3d65e246f1e3eef0a6ea2341dceaeff0096dbe99
Binary files /dev/null and b/gen_compare/control_images/converted/control_human_openpose.png differ
diff --git a/gen_compare/control_images/converted/control_human_scribble.png b/gen_compare/control_images/converted/control_human_scribble.png
new file mode 100644
index 0000000000000000000000000000000000000000..c112563f0c72f215e7cf34d71d15190e32bcde4f
Binary files /dev/null and b/gen_compare/control_images/converted/control_human_scribble.png differ
diff --git a/gen_compare/control_images/converted/control_human_seg.png b/gen_compare/control_images/converted/control_human_seg.png
new file mode 100644
index 0000000000000000000000000000000000000000..e43800f87b1196c0e3daea93f7168b65377dcac2
Binary files /dev/null and b/gen_compare/control_images/converted/control_human_seg.png differ
diff --git a/gen_compare/control_images/converted/control_room_canny.png b/gen_compare/control_images/converted/control_room_canny.png
new file mode 100644
index 0000000000000000000000000000000000000000..5633c9c0c83023798e9775072d2f142ab05ff742
Binary files /dev/null and b/gen_compare/control_images/converted/control_room_canny.png differ
diff --git a/gen_compare/control_images/converted/control_room_depth.png b/gen_compare/control_images/converted/control_room_depth.png
new file mode 100644
index 0000000000000000000000000000000000000000..3a4b62487629dc4f7fef238b53e8fce10ab13549
Binary files /dev/null and b/gen_compare/control_images/converted/control_room_depth.png differ
diff --git a/gen_compare/control_images/converted/control_room_hed.png b/gen_compare/control_images/converted/control_room_hed.png
new file mode 100644
index 0000000000000000000000000000000000000000..77b8e99ab73100774833bc79297e31c3a12eb7a4
Binary files /dev/null and b/gen_compare/control_images/converted/control_room_hed.png differ
diff --git a/gen_compare/control_images/converted/control_room_mlsd.png b/gen_compare/control_images/converted/control_room_mlsd.png
new file mode 100644
index 0000000000000000000000000000000000000000..5438b8797d9f6de198ce9460ef37214e6f5fc6a1
Binary files /dev/null and b/gen_compare/control_images/converted/control_room_mlsd.png differ
diff --git a/gen_compare/control_images/converted/control_room_normal.png b/gen_compare/control_images/converted/control_room_normal.png
new file mode 100644
index 0000000000000000000000000000000000000000..d5ec2c12832117b0c030a5a9566a6b9517e8aa6f
Binary files /dev/null and b/gen_compare/control_images/converted/control_room_normal.png differ
diff --git a/gen_compare/control_images/converted/control_room_openpose.png b/gen_compare/control_images/converted/control_room_openpose.png
new file mode 100644
index 0000000000000000000000000000000000000000..5220d0f9dbfa747cdb356761a73beb1b1f1c96bb
Binary files /dev/null and b/gen_compare/control_images/converted/control_room_openpose.png differ
diff --git a/gen_compare/control_images/converted/control_room_scribble.png b/gen_compare/control_images/converted/control_room_scribble.png
new file mode 100644
index 0000000000000000000000000000000000000000..6f42ed00311281bd9b16685619d9b8306e4e0102
Binary files /dev/null and b/gen_compare/control_images/converted/control_room_scribble.png differ
diff --git a/gen_compare/control_images/converted/control_room_seg.png b/gen_compare/control_images/converted/control_room_seg.png
new file mode 100644
index 0000000000000000000000000000000000000000..5f5b75380c2cd4767409689996b3dbddbf3109a6
Binary files /dev/null and b/gen_compare/control_images/converted/control_room_seg.png differ
diff --git a/gen_compare/control_images/converted/control_vermeer_canny.png b/gen_compare/control_images/converted/control_vermeer_canny.png
new file mode 100644
index 0000000000000000000000000000000000000000..70bc422fd229c351e504fa0a435871927765cba7
Binary files /dev/null and b/gen_compare/control_images/converted/control_vermeer_canny.png differ
diff --git a/gen_compare/control_images/converted/control_vermeer_depth.png b/gen_compare/control_images/converted/control_vermeer_depth.png
new file mode 100644
index 0000000000000000000000000000000000000000..22a8edf9edf5c6d4a53dea939091c3a36ce322f1
Binary files /dev/null and b/gen_compare/control_images/converted/control_vermeer_depth.png differ
diff --git a/gen_compare/control_images/converted/control_vermeer_hed.png b/gen_compare/control_images/converted/control_vermeer_hed.png
new file mode 100644
index 0000000000000000000000000000000000000000..d88d6b02607f26b493659bffde7ce06c41722dc7
Binary files /dev/null and b/gen_compare/control_images/converted/control_vermeer_hed.png differ
diff --git a/gen_compare/control_images/converted/control_vermeer_mlsd.png b/gen_compare/control_images/converted/control_vermeer_mlsd.png
new file mode 100644
index 0000000000000000000000000000000000000000..3e8dfea535b1c49c7c8641d14b9870b345dbee0a
Binary files /dev/null and b/gen_compare/control_images/converted/control_vermeer_mlsd.png differ
diff --git a/gen_compare/control_images/converted/control_vermeer_normal.png b/gen_compare/control_images/converted/control_vermeer_normal.png
new file mode 100644
index 0000000000000000000000000000000000000000..cb115ca6152dd521904a37944d6a121544c926f7
Binary files /dev/null and b/gen_compare/control_images/converted/control_vermeer_normal.png differ
diff --git a/gen_compare/control_images/converted/control_vermeer_openpose.png b/gen_compare/control_images/converted/control_vermeer_openpose.png
new file mode 100644
index 0000000000000000000000000000000000000000..b24493813b46e639fbda7d588021bbddc50493a5
Binary files /dev/null and b/gen_compare/control_images/converted/control_vermeer_openpose.png differ
diff --git a/gen_compare/control_images/converted/control_vermeer_scribble.png b/gen_compare/control_images/converted/control_vermeer_scribble.png
new file mode 100644
index 0000000000000000000000000000000000000000..4fdf2eb234945792667504ae4d4fd4f9f7b4fc24
Binary files /dev/null and b/gen_compare/control_images/converted/control_vermeer_scribble.png differ
diff --git a/gen_compare/control_images/converted/control_vermeer_seg.png b/gen_compare/control_images/converted/control_vermeer_seg.png
new file mode 100644
index 0000000000000000000000000000000000000000..90c71a363e5ae248cf0daae50c9d0276545d753d
Binary files /dev/null and b/gen_compare/control_images/converted/control_vermeer_seg.png differ
diff --git a/gen_compare/control_images/human_512x512.png b/gen_compare/control_images/human_512x512.png
new file mode 100644
index 0000000000000000000000000000000000000000..39f6e44c83fba37b635bdd168d40799a61c735a3
Binary files /dev/null and b/gen_compare/control_images/human_512x512.png differ
diff --git a/gen_compare/control_images/room_512x512.png b/gen_compare/control_images/room_512x512.png
new file mode 100644
index 0000000000000000000000000000000000000000..8c394f16de440852e0291440a71df5899455703c
Binary files /dev/null and b/gen_compare/control_images/room_512x512.png differ
diff --git a/gen_compare/control_images/vermeer_512x512.png b/gen_compare/control_images/vermeer_512x512.png
new file mode 100644
index 0000000000000000000000000000000000000000..6cf55c251f4df73027e18bab82ef5ed4c554a7c8
Binary files /dev/null and b/gen_compare/control_images/vermeer_512x512.png differ
diff --git a/gen_compare/create_control_images.py b/gen_compare/create_control_images.py
new file mode 100644
index 0000000000000000000000000000000000000000..bf1ac900e79d26014a883a7c222735b97484e4d0
--- /dev/null
+++ b/gen_compare/create_control_images.py
@@ -0,0 +1,29 @@
+from PIL import Image
+import controlnet_hinter
+
+
+#model_suffixes = {"canny","normal","depth","openpose","hed","scribble","mlsd","seg"}
+
+
+def write_converted_files(original_image, prefix):
+ controlnet_hinter.hint_canny(original_image).save(prefix + '_canny.png')
+ controlnet_hinter.hint_depth(original_image).save(prefix + '_depth.png')
+ controlnet_hinter.hint_fake_scribble(original_image).save(
+ prefix + '_scribble.png')
+ controlnet_hinter.hint_hed(original_image).save(prefix + '_hed.png')
+ controlnet_hinter.hint_hough(original_image).save(prefix + '_mlsd.png')
+ controlnet_hinter.hint_normal(original_image).save(prefix + '_normal.png')
+ controlnet_hinter.hint_openpose(
+ original_image).save(prefix + '_openpose.png')
+ # controlnet_hinter.hint_scribble(
+ # original_image).save(prefix + '_scribble.png')
+ controlnet_hinter.hint_segmentation(
+ original_image).save(prefix + '_seg.png')
+
+
+if __name__ == '__main__':
+ image_types = {'bird', 'human', 'room', 'vermeer'}
+ for itype in image_types:
+ image = Image.open(f"control_images/{itype}_512x512.png")
+ write_converted_files(
+ image, prefix=f'control_images/converted/control_{itype}')
diff --git a/gen_compare/create_plots.py b/gen_compare/create_plots.py
new file mode 100644
index 0000000000000000000000000000000000000000..b967fb3325c21a220791e2685a34bf2032ca0e0b
--- /dev/null
+++ b/gen_compare/create_plots.py
@@ -0,0 +1,50 @@
+
+import matplotlib.pyplot as plt
+from PIL import Image
+
+plt.rcParams["figure.figsize"] = (10, 5)
+plt.rcParams['figure.facecolor'] = 'white'
+
+
+def render_figure(model_name, fn):
+ image_types = ['bird', 'human', 'room', 'vermeer']
+
+ def plot_row(axs, control_fn_prefix, output_fn_prefix, name, show_control=False):
+ for i, ax in enumerate(axs):
+ if i == 0:
+ if show_control:
+ ax.set_title(f'Control')
+ ax.imshow(Image.open(f'{control_fn_prefix}.png'))
+ else:
+ ax.set_title(f'Seed={i-1} ({name})')
+ ax.imshow(Image.open(f'{output_fn_prefix}_{i-1}.png'))
+
+ fig, axs = plt.subplots(
+ 2 * len(image_types), 5, layout="constrained", figsize=(10, 5 * len(image_types)))
+ for ax in axs.flatten():
+ ax.set_aspect('equal', 'box')
+ ax.axis('off')
+
+ pair_axs = [list(pair) for pair in zip(axs[::2], axs[1::2])]
+ for image_type, pair_ax in zip(image_types, pair_axs):
+ plot_row(pair_ax[0],
+ f'./control_images/converted/control_{image_type}_{model_name}',
+ f'./output_images/diffusers/output_{image_type}_{model_name}',
+ 'Diffusers', show_control=True)
+ plot_row(pair_ax[1],
+ f'./control_images/converted/control_{image_type}_{model_name}',
+ f'./output_images/ref/output_{image_type}_{model_name}',
+ 'ref impl.')
+
+ fig.suptitle(f'Model: {model_name}', fontsize=16)
+ # fig.tight_layout()
+ fig.savefig(fn, dpi=144)
+
+
+if __name__ == '__main__':
+ model_names = ["canny", "normal", "depth",
+ "openpose", "hed", "scribble", "mlsd", "seg"]
+ for model in model_names:
+ fn = f"plots/figure_{model}.png"
+ render_figure(model, fn)
+ print(fn)
diff --git a/gen_compare/gen_diffusers_image.py b/gen_compare/gen_diffusers_image.py
new file mode 100644
index 0000000000000000000000000000000000000000..df29ee2caf86bb237a0aa40b93255c25394f3e6b
--- /dev/null
+++ b/gen_compare/gen_diffusers_image.py
@@ -0,0 +1,49 @@
+# Diffusers' ControlNet Implementation Subjective Evaluation
+# https://github.com/takuma104/diffusers/tree/controlnet
+
+import einops
+import numpy as np
+import torch
+import sys
+
+from diffusers import StableDiffusionControlNetPipeline
+
+from PIL import Image
+
+test_prompt = "best quality, extremely detailed, illustration, looking at viewer"
+test_negative_prompt = "monochrome, lowres, bad anatomy, worst quality, low quality"
+
+def generate_image(seed, control):
+ latent = torch.randn((1,4,64,64), device="cpu", generator=torch.Generator(device="cpu").manual_seed(seed)).cuda()
+ image = pipe(
+ prompt=test_prompt,
+ negative_prompt=test_negative_prompt,
+ guidance_scale=9.0,
+ num_inference_steps=20,
+ latents=latent,
+ #generator=torch.Generator(device="cuda").manual_seed(seed),
+ image=control,
+ ).images[0]
+ return image
+
+if __name__ == '__main__':
+ model_name = sys.argv[1]
+ control_image_folder = '../huggingface/controlnet_dev/gen_compare/control_images/converted/'
+ output_image_folder = '../huggingface/controlnet_dev/gen_compare/output_images/diffusers/'
+ model_id = f'../huggingface/control_sd15_{model_name}'
+
+ pipe = StableDiffusionControlNetPipeline.from_pretrained(model_id).to("cuda")
+ pipe.enable_attention_slicing(1)
+
+ image_types = {'bird', 'human', 'room', 'vermeer'}
+
+ for image_type in image_types:
+ control_image = Image.open(f'{control_image_folder}control_{image_type}_{model_name}.png')
+ control = np.array(control_image)[:,:,::-1].copy()
+ control = torch.from_numpy(control).float().cuda() / 255.0
+ control = torch.stack([control for _ in range(1)], dim=0)
+ control = einops.rearrange(control, 'b h w c -> b c h w').clone()
+
+ for seed in range(4):
+ image = generate_image(seed=seed, control=control)
+ image.save(f'{output_image_folder}output_{image_type}_{model_name}_{seed}.png')
\ No newline at end of file
diff --git a/gen_compare/gen_diffusers_image.sh b/gen_compare/gen_diffusers_image.sh
new file mode 100644
index 0000000000000000000000000000000000000000..10363253d42648d1bf732106db7348838dbdeeec
--- /dev/null
+++ b/gen_compare/gen_diffusers_image.sh
@@ -0,0 +1,9 @@
+#!/bin/bash
+
+models=("canny" "normal" "depth" "openpose" "hed" "scribble" "mlsd" "seg")
+
+for model in "${models[@]}"
+do
+ echo $model
+ python gen_diffusers_image.py $model
+done
\ No newline at end of file
diff --git a/gen_compare/gen_reference_image.py b/gen_compare/gen_reference_image.py
new file mode 100644
index 0000000000000000000000000000000000000000..ffe7f8aa77e3b2088da06f96162b65efd7f357d1
--- /dev/null
+++ b/gen_compare/gen_reference_image.py
@@ -0,0 +1,60 @@
+# from https://github.com/lllyasviel/ControlNet/blob/main/gradio_canny2image.py
+
+from share import *
+
+import einops
+import numpy as np
+import torch
+from PIL import Image
+import sys
+
+from pytorch_lightning import seed_everything
+from cldm.model import create_model, load_state_dict
+from ldm.models.diffusion.ddim import DDIMSampler
+from diffusers.utils import load_image
+
+test_prompt = "best quality, extremely detailed, illustration, looking at viewer"
+test_negative_prompt = "monochrome, lowres, bad anatomy, worst quality, low quality"
+
+@torch.no_grad()
+def generate(prompt, n_prompt, seed, control, ddim_steps=20, eta=0.0, scale=9.0, H=512, W=512):
+ seed_everything(seed)
+
+ cond = {"c_concat": [control], "c_crossattn": [model.get_learned_conditioning([prompt] * num_samples)]}
+ un_cond = {"c_concat": [control], "c_crossattn": [model.get_learned_conditioning([n_prompt] * num_samples)]}
+ shape = (4, H // 8, W // 8)
+
+ latent = torch.randn((1,) + shape, device="cpu", generator=torch.Generator(device="cpu").manual_seed(seed)).cuda()
+ samples, intermediates = ddim_sampler.sample(ddim_steps, num_samples,
+ shape, cond, x_T=latent,
+ verbose=False, eta=eta,
+ unconditional_guidance_scale=scale,
+ unconditional_conditioning=un_cond)
+ x_samples = model.decode_first_stage(samples)
+ x_samples = (einops.rearrange(x_samples, 'b c h w -> b h w c') * 127.5 + 127.5).cpu().numpy().clip(0, 255).astype(np.uint8)
+
+ return Image.fromarray(x_samples[0])
+
+if __name__ == '__main__':
+ model_name = sys.argv[1]
+ control_image_folder = '../huggingface/controlnet_dev/gen_compare/control_images/converted/'
+ output_image_folder = '../huggingface/controlnet_dev/gen_compare/output_images/ref/'
+
+ num_samples = 1
+ model = create_model('./models/cldm_v15.yaml').cpu()
+ model.load_state_dict(load_state_dict(f'../huggingface/ControlNet/models/control_sd15_{model_name}.pth', location='cpu'))
+ model = model.cuda()
+ ddim_sampler = DDIMSampler(model)
+
+ image_types = {'bird', 'human', 'room', 'vermeer'}
+
+ for image_type in image_types:
+ control_image = Image.open(f'{control_image_folder}control_{image_type}_{model_name}.png')
+ control = np.array(control_image)[:,:,::-1].copy()
+ control = torch.from_numpy(control).float().cuda() / 255.0
+ control = torch.stack([control for _ in range(num_samples)], dim=0)
+ control = einops.rearrange(control, 'b h w c -> b c h w').clone()
+
+ for seed in range(4):
+ image = generate(test_prompt, test_negative_prompt, seed=seed, control=control)
+ image.save(f'{output_image_folder}output_{image_type}_{model_name}_{seed}.png')
\ No newline at end of file
diff --git a/gen_compare/gen_reference_image.sh b/gen_compare/gen_reference_image.sh
new file mode 100644
index 0000000000000000000000000000000000000000..2ecc75f47b92777c33e1d2f83d949ad850bc3463
--- /dev/null
+++ b/gen_compare/gen_reference_image.sh
@@ -0,0 +1,9 @@
+#!/bin/bash
+
+models=("canny" "normal" "depth" "openpose" "hed" "scribble" "mlsd" "seg")
+
+for model in "${models[@]}"
+do
+ echo $model
+ python gen_reference_image.py $model
+done
\ No newline at end of file
diff --git a/gen_compare/plots/figure_canny.png b/gen_compare/plots/figure_canny.png
new file mode 100644
index 0000000000000000000000000000000000000000..1c9b16c68e0b82f85aa18333988b942488ef505b
--- /dev/null
+++ b/gen_compare/plots/figure_canny.png
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:136e3469b21258687a44e169434f14d13c2f9a53bc6e06f3ae7a756a7570634d
+size 4857849
diff --git a/gen_compare/plots/figure_depth.png b/gen_compare/plots/figure_depth.png
new file mode 100644
index 0000000000000000000000000000000000000000..b6cf70e6e3f45a16e56ddce7a5368724d97a6dc3
--- /dev/null
+++ b/gen_compare/plots/figure_depth.png
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:f88ffbf3d0048227ab4503ed84aa008c5ba0a02ff0b908a9b8d10a65877ae468
+size 5052278
diff --git a/gen_compare/plots/figure_hed.png b/gen_compare/plots/figure_hed.png
new file mode 100644
index 0000000000000000000000000000000000000000..25ddb4d1662c200f7d474d0415590b361cd39c14
--- /dev/null
+++ b/gen_compare/plots/figure_hed.png
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:e1b7006818160e43f26755f1ef465709103a3e31d1f8343d74afae9ef81c716a
+size 5532738
diff --git a/gen_compare/plots/figure_mlsd.png b/gen_compare/plots/figure_mlsd.png
new file mode 100644
index 0000000000000000000000000000000000000000..2cb51ea8e2a03cb4d082805463d10cd643d452e5
--- /dev/null
+++ b/gen_compare/plots/figure_mlsd.png
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:d151503fe59873a33cf7459d43f954b54a5fd2e204730c158080c6c989b05dd8
+size 5310724
diff --git a/gen_compare/plots/figure_normal.png b/gen_compare/plots/figure_normal.png
new file mode 100644
index 0000000000000000000000000000000000000000..00729fd641fb27f0d7497b71b0355b3baca03c4d
--- /dev/null
+++ b/gen_compare/plots/figure_normal.png
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:d3dabe7ec0a489fa274c4f34024912e2944087298eb428dce9c983536b3f4095
+size 5155788
diff --git a/gen_compare/plots/figure_openpose.png b/gen_compare/plots/figure_openpose.png
new file mode 100644
index 0000000000000000000000000000000000000000..71e082281282319fd3a384b178e773902cac371f
--- /dev/null
+++ b/gen_compare/plots/figure_openpose.png
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:89a7e155c256d7aaa5413e83133b4d87bc02a27d17a6c0fdc21ea79e6e4931ba
+size 5531772
diff --git a/gen_compare/plots/figure_scribble.png b/gen_compare/plots/figure_scribble.png
new file mode 100644
index 0000000000000000000000000000000000000000..37b0009fb80a40f58370e58394bf1118978f4ce0
--- /dev/null
+++ b/gen_compare/plots/figure_scribble.png
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:71e8104e05d1420027d399b89623a9edab290fc52c8fb95a1e26f5ecf6dd7a35
+size 5388253
diff --git a/gen_compare/plots/figure_seg.png b/gen_compare/plots/figure_seg.png
new file mode 100644
index 0000000000000000000000000000000000000000..ddf0f583a694fb28895aacf6c63d4e8fd8f39b27
--- /dev/null
+++ b/gen_compare/plots/figure_seg.png
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:50ed01be41f3508a47e6a0cf50bb22f56a44e7916ca18364a2860b95049f138e
+size 5546840