INNER CODE UNIT · Python
save_image
fashn-AI/fashn-vton-1.5 · scripts/debug_masks.py:78
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)
print(f" Saved: {filepath}")
def create_clothing_agnostic_image_debug(
img_np: np.ndarray,
seg_pred: np.ndarray,
labels_to_segment_indices: list,
body_coverage: str,
output_dir: str,
mask_value: int = 127,
min_distance_threshold: float = 100.0,