INNER CODE UNIT · Python

mask_img

fashn-AI/fashn-vton-1.5 · scripts/debug_masks.py:67

        mask_img = (mask.astype(np.uint8) * 255)
    else:
        mask_img = mask.astype(np.uint8)
        if mask_img.max() == 1:
            mask_img = mask_img * 255

    filepath = os.path.join(path, f"{name}.png")
    cv2.imwrite(filepath, mask_img)
    print(f"  Saved: {filepath}")


def save_image(img: np.ndarray, path: str, name: str):
    """Save RGB image."""
    filepath = os.path.join(path, f"{name}.png")
    if img.shape[-1] == 3:
        cv2.imwrite(filepath, cv2.cvtColor(img, cv2.COLOR_RGB2BGR))
    else:
        cv2.imwrite(filepath, img)

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…