remove ##
Browse files
diffusers3/pipelines/controlnet/.ipynb_checkpoints/pipeline_controlnet_sd_xl_img2img_img-checkpoint.py
CHANGED
|
@@ -211,8 +211,8 @@ def prepare_mask(
|
|
| 211 |
mask[mask < 0.5] = 0
|
| 212 |
mask[mask >= 0.5] = 1
|
| 213 |
else:
|
| 214 |
-
|
| 215 |
-
|
| 216 |
# preprocess mask
|
| 217 |
if isinstance(mask, (PIL.Image.Image, np.ndarray)):
|
| 218 |
mask = [mask]
|
|
@@ -1454,7 +1454,7 @@ class StableDiffusionXLControlNetImg2ImgPipeline(
|
|
| 1454 |
coeff_after = (ZAc.reshape(B,-1) @ u)
|
| 1455 |
coeff_ratio = (coeff_after.abs().mean() / (coeff_before.abs().mean() + eps)).item()
|
| 1456 |
energy_ratio = (coeff_after.pow(2).mean() / (coeff_before.pow(2).mean() + eps)).item()
|
| 1457 |
-
|
| 1458 |
|
| 1459 |
# ---------------------- add noise (original) ----------------------
|
| 1460 |
if add_noise:
|
|
@@ -1933,9 +1933,9 @@ class StableDiffusionXLControlNetImg2ImgPipeline(
|
|
| 1933 |
hf_in_ratio = (hf_in1 / (hf_in0 + eps))
|
| 1934 |
hf_out_ratio = (hf_out1 / (hf_out0 + eps))
|
| 1935 |
|
| 1936 |
-
|
| 1937 |
-
|
| 1938 |
-
|
| 1939 |
|
| 1940 |
|
| 1941 |
|
|
|
|
| 211 |
mask[mask < 0.5] = 0
|
| 212 |
mask[mask >= 0.5] = 1
|
| 213 |
else:
|
| 214 |
+
# print("^^^^")
|
| 215 |
+
# print("mask_2")
|
| 216 |
# preprocess mask
|
| 217 |
if isinstance(mask, (PIL.Image.Image, np.ndarray)):
|
| 218 |
mask = [mask]
|
|
|
|
| 1454 |
coeff_after = (ZAc.reshape(B,-1) @ u)
|
| 1455 |
coeff_ratio = (coeff_after.abs().mean() / (coeff_before.abs().mean() + eps)).item()
|
| 1456 |
energy_ratio = (coeff_after.pow(2).mean() / (coeff_before.pow(2).mean() + eps)).item()
|
| 1457 |
+
# print(f" !!!![Garment|Projection] coeff ↓ ratio = {coeff_ratio:.4f}, energy ↓ ratio = {energy_ratio:.4f}")
|
| 1458 |
|
| 1459 |
# ---------------------- add noise (original) ----------------------
|
| 1460 |
if add_noise:
|
|
|
|
| 1933 |
hf_in_ratio = (hf_in1 / (hf_in0 + eps))
|
| 1934 |
hf_out_ratio = (hf_out1 / (hf_out0 + eps))
|
| 1935 |
|
| 1936 |
+
# print(f"[Diag|Align] A=Δz·u energy fraction (inside) = {align_idx:.3f} (↑면 투영)")
|
| 1937 |
+
# print(f"[Diag|Perp] perp/u energy ratio (inside) = {perp_u_ratio:.3f} (↓면 투영)")
|
| 1938 |
+
# print(f"[Diag|HF] inside HF ratio={hf_in_ratio:.3f}, outside HF ratio={hf_out_ratio:.3f} (블러면 HF≪1)")
|
| 1939 |
|
| 1940 |
|
| 1941 |
|
diffusers3/pipelines/controlnet/pipeline_controlnet_sd_xl_img2img_img.py
CHANGED
|
@@ -211,8 +211,8 @@ def prepare_mask(
|
|
| 211 |
mask[mask < 0.5] = 0
|
| 212 |
mask[mask >= 0.5] = 1
|
| 213 |
else:
|
| 214 |
-
|
| 215 |
-
|
| 216 |
# preprocess mask
|
| 217 |
if isinstance(mask, (PIL.Image.Image, np.ndarray)):
|
| 218 |
mask = [mask]
|
|
@@ -1454,7 +1454,7 @@ class StableDiffusionXLControlNetImg2ImgPipeline(
|
|
| 1454 |
coeff_after = (ZAc.reshape(B,-1) @ u)
|
| 1455 |
coeff_ratio = (coeff_after.abs().mean() / (coeff_before.abs().mean() + eps)).item()
|
| 1456 |
energy_ratio = (coeff_after.pow(2).mean() / (coeff_before.pow(2).mean() + eps)).item()
|
| 1457 |
-
|
| 1458 |
|
| 1459 |
# ---------------------- add noise (original) ----------------------
|
| 1460 |
if add_noise:
|
|
@@ -1933,9 +1933,9 @@ class StableDiffusionXLControlNetImg2ImgPipeline(
|
|
| 1933 |
hf_in_ratio = (hf_in1 / (hf_in0 + eps))
|
| 1934 |
hf_out_ratio = (hf_out1 / (hf_out0 + eps))
|
| 1935 |
|
| 1936 |
-
|
| 1937 |
-
|
| 1938 |
-
|
| 1939 |
|
| 1940 |
|
| 1941 |
|
|
|
|
| 211 |
mask[mask < 0.5] = 0
|
| 212 |
mask[mask >= 0.5] = 1
|
| 213 |
else:
|
| 214 |
+
# print("^^^^")
|
| 215 |
+
# print("mask_2")
|
| 216 |
# preprocess mask
|
| 217 |
if isinstance(mask, (PIL.Image.Image, np.ndarray)):
|
| 218 |
mask = [mask]
|
|
|
|
| 1454 |
coeff_after = (ZAc.reshape(B,-1) @ u)
|
| 1455 |
coeff_ratio = (coeff_after.abs().mean() / (coeff_before.abs().mean() + eps)).item()
|
| 1456 |
energy_ratio = (coeff_after.pow(2).mean() / (coeff_before.pow(2).mean() + eps)).item()
|
| 1457 |
+
# print(f" !!!![Garment|Projection] coeff ↓ ratio = {coeff_ratio:.4f}, energy ↓ ratio = {energy_ratio:.4f}")
|
| 1458 |
|
| 1459 |
# ---------------------- add noise (original) ----------------------
|
| 1460 |
if add_noise:
|
|
|
|
| 1933 |
hf_in_ratio = (hf_in1 / (hf_in0 + eps))
|
| 1934 |
hf_out_ratio = (hf_out1 / (hf_out0 + eps))
|
| 1935 |
|
| 1936 |
+
# print(f"[Diag|Align] A=Δz·u energy fraction (inside) = {align_idx:.3f} (↑면 투영)")
|
| 1937 |
+
# print(f"[Diag|Perp] perp/u energy ratio (inside) = {perp_u_ratio:.3f} (↓면 투영)")
|
| 1938 |
+
# print(f"[Diag|HF] inside HF ratio={hf_in_ratio:.3f}, outside HF ratio={hf_out_ratio:.3f} (블러면 HF≪1)")
|
| 1939 |
|
| 1940 |
|
| 1941 |
|