(gt_label, pred_label, class_num)
return confusion_matrix
Calcute the confusion matrix by given label and pred
    :param gt_label: the ground truth label
    :param pred_label: the pred label
    :param class_num: the nunber of class
    :return: the confusion matrix
Calcute the confusion matrix by given label and pred
    :param gt_label: the ground truth label
    :param pred_label: the pred label
    :param class_num: the nunber of class
    :return: the confusion matrix
Calcute the confusion matrix by given label and pred : param gt_label : the ground truth label : param pred_label : the pred label : param class_num : the nunber of class : return : the confusion matrix
def get_confusion_matrix(gt_label, pred_label, class_num):
    """
    Calcute the confusion matrix by given label and pred
    :param gt_label: the ground truth label
    :param pred_label: the pred label
    :param class_num: the nunber of class
    :return: the confusion matrix
    """
    index = (gt_label * class_num + pred_label).astype('int32')
    label_count = np.bincount(index)
    confusion_matrix = np.zeros((class_num, class_num))

    for i_label in range(class_num):
        for i_pred_label in range(class_num):
            cur_index = i_label * class_num + i_pred_label
            if cur_index < len(label_count):
                confusion_matrix[i_label, i_pred_label] = label_count[cur_index]

    return confusion_matrix
def get_confusion_matrix ( gt_label , pred_label , class_num ) : index = ( gt_label * class_num + pred_label ) . astype ( 'int32' ) label_count = np . bincount ( index ) confusion_matrix = np . zeros ( ( class_num , class_num ) ) for i_label in range ( class_num ) : for i_pred_label in range ( class_num ) : cur_index = i_label * class_num + i_pred_label if cur_index < len ( label_count ) : confusion_matrix [ i_label , i_pred_label ] = label_count [ cur_index ] return confusion_matrix