VTON / utils_mask.py
Eleyaraja's picture
Add IDM-VTON app without cache files
25ea678
from PIL import Image
import numpy as np
def get_mask_location(resolution_mode, body_part, model_parse, keypoints):
"""
Dummy stub for get_mask_location, returns a white mask and mask grayscale
keyed by inputs.
Args:
resolution_mode (str): Resolution mode, e.g., 'hd'
body_part (str): Body part string, e.g., 'upper_body'
model_parse: segmentation mask from parsing model
keypoints: keypoints from pose model
Returns:
mask (PIL.Image): Binary/white mask PIL image
mask_gray (PIL.Image): Grayscale mask PIL image
"""
size = (768, 1024) # default size expected
mask = Image.fromarray(np.ones((size[1], size[0]), dtype=np.uint8) * 255) # white mask
mask_gray = mask.copy() # grayscale same as mask for this stub
return mask, mask_gray