INNER CODE UNIT · Python
colorize_segmentation
fashn-AI/fashn-vton-1.5 · scripts/debug_masks.py:30
def colorize_segmentation(seg_pred: np.ndarray) -> np.ndarray:
"""Convert segmentation prediction to colorized visualization."""
# Define colors for each label (18 classes + background)
colors = [
[0, 0, 0], # 0: background
[255, 0, 0], # 1: top
[0, 255, 0], # 2: bottom
[0, 0, 255], # 3: dress
[255, 255, 0], # 4: outerwear
[255, 0, 255], # 5: headwear
[0, 255, 255], # 6: eyewear
[128, 0, 0], # 7: footwear
[0, 128, 0], # 8: bag
[0, 0, 128], # 9: accessory
[128, 128, 0], # 10: belt
[128, 0, 128], # 11: face
[0, 128, 128], # 12: hair
[255, 128, 0], # 13: arms