File size: 1,701 Bytes
28c838b |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 |
import sys
import yaml
import os
cnet_models = [
"p_sd15_canny",
"p_sd15_depth",
"p_sd15_mlsd" ,
"p_sd15_normalbae",
"p_sd15_openpose",
"p_sd15_scribble",
"p_sd15_seg",
"p_sd15_softedge",
"p_sd15_lineart",
"p_sd15s2_lineart_anime",
# "p_sd15_inpaint",
# "e_sd15_shuffle",
# "e_sd15_ip2p",
# "u_sd15_tile",
]
processors = ["ref", "diffusers"]
print(f"# ControlNet Generation Comparison")
print("")
def control_image_filenames(model_name):
with open('./control_images.yaml', 'r') as f:
d = yaml.safe_load(f)
return d[model_name]
def print_header():
print("|seed|conditional image|", end="")
for proc in processors:
print(f"{proc}|", end="")
print("")
print("|", end="")
for _ in range(len(processors) + 2):
print(":---:|", end="")
print("")
def get_url(path):
url = "./"
# url = 'https://huggingface.co/takuma104/controlnet_dev/resolve/main/gen_compare_v11/'
return url + path
control_image_folder = './control_images/converted/'
for cnet in cnet_models:
print(f"## control_v11{cnet}")
print("")
print_header()
for i, control_image_fn in enumerate(control_image_filenames(cnet)):
for seed in range(4):
print(f"|{seed}|", end="")
url = get_url(path=f"{control_image_folder}/{control_image_fn}")
print(f'<a href="{url}"><img width="128" src="{url}"/></a>|', end="")
for proc in processors:
url = get_url(path=f"output_images/{proc}/output_{cnet}_{i}_{seed:01d}.png")
print(f'<a href="{url}"><img width="128" src="{url}"/></a>|', end="")
print("")
|