def get_pseudo_color_map(pred, color_map=None, use_multilabel=False):
    """
    Get the pseudo color image.

    Args:
        pred (numpy.ndarray): the origin predicted image.
        color_map (list, optional): the palette color map. Default: None,
            use paddleseg's default color map.
        use_multilabel (bool, optional): Whether to enable multilabel mode. Default: False.

    Returns:
        (numpy.ndarray): the pseduo image.
    """
    if use_multilabel:
        bg_pred = (pred.sum(axis=0, keepdims=True) == 0).astype('int32')
        pred = np.concatenate([bg_pred, pred], axis=0)
        gray_idx = np.arange(pred.shape[0]).astype(np.uint8)
        pred = (pred * gray_idx[:, None, None]).sum(axis=0)
    pred_mask = PILImage.fromarray(pred.astype(np.uint8), mode='P')
    if color_map is None:
        color_map = get_color_map_list(256)
    pred_mask.putpalette(color_map)
    return pred_mask

    Get the pseudo color image.

    Args:
        pred (numpy.ndarray): the origin predicted image.
        color_map (list, optional): the palette color map. Default: None,
            use paddleseg's default color map.
        use_multilabel (bool, optional): Whether to enable multilabel mode. Default: False.

    Returns:
        (numpy.ndarray): the pseduo image.
    
paddleseg/utils/visualize.py