INNER CODE UNIT · Python
mask_scale
Shilin-LU/TF-ICON · scripts/app.py:178
mask_scale = new_w * aspect_ratio / 256
mask_scale = new_h / 256
else:
mask_scale = new_w / 256
mask_scale = new_h / (aspect_ratio * 256)
# mask_scale = round(mask_scale, 2)
# =============================================================================================
data = [batch_size * [prompt]]
# read background image
init_image, target_width, target_height = load_img(init_img, mask_scale)
init_image = repeat(init_image.to(device), '1 ... -> b ...', b=batch_size)
save_image = init_image.clone()
# read foreground image and its segmentation map
ref_image, width, height, segmentation_map = load_img(ref_img, mask_scale, seg_map=seg, target_size=(target_width, target_height))