def convert_pred_map(seg_pred, pan_pred):
        """
        Convet the predictions with format (h*w) to the format that satisfies the AP calculation.

        Args:
            seg_pred (np.ndarray): the sementic segmentation map with shape C * H * W. Value is probability.
            pan_pred (np.ndarray): panoptic predictions, void_label, stuff_id * label_divisor, thing_id * label_divisor + ins_id , ins_id >= 1.

        Returns:
            list: tuple list like: [(label, score, mask), ...]
        """
        preds = []
        instance_cnt = np.unique(pan_pred)
        for i in instance_cnt:
            if (i < 1000) or (i % 1000 == 0):
                continue
            mask = pan_pred == i
            label = i // 1000
            score = np.mean(seg_pred[label][mask])
            preds.append((label, score, mask.astype('int32')))
        return preds

        Convet the predictions with format (h*w) to the format that satisfies the AP calculation.

        Args:
            seg_pred (np.ndarray): the sementic segmentation map with shape C * H * W. Value is probability.
            pan_pred (np.ndarray): panoptic predictions, void_label, stuff_id * label_divisor, thing_id * label_divisor + ins_id , ins_id >= 1.

        Returns:
            list: tuple list like: [(label, score, mask), ...]
        
contrib/PanopticDeepLab/utils/evaluation/instance.py