def accuracy_assessment(gt_changed, gt_unchanged, changed_map):
    """
   assess accuracy of changed map based on ground truth
   :param gt_changed: changed ground truth
   :param gt_unchanged: unchanged ground truth
   :param changed_map: changed map
   :return: confusion matrix and overall accuracy
   """
    cm = []

    gt = []

    height, width = changed_map.shape
    changed_map = np.reshape(changed_map, (-1,))
    gt_changed = np.reshape(gt_changed, (-1,))
    gt_unchanged = np.reshape(gt_unchanged, (-1,))

    cm = np.ones((height * width,))
    cm[changed_map == 255] = 2

    gt = np.zeros((height * width,))
    gt[gt_changed == 255] = 2
    gt[gt_unchanged == 255] = 1

    conf_mat = confusion_matrix(y_true=gt, y_pred=cm,
                                labels=[1, 2])
    kappa_co = cohen_kappa_score(y1=gt, y2=cm,
                                 labels=[1, 2])

    oa = np.sum(conf_mat.diagonal()) / np.sum(conf_mat)

    return conf_mat, oa, kappa_co

   assess accuracy of changed map based on ground truth
   :param gt_changed: changed ground truth
   :param gt_unchanged: unchanged ground truth
   :param changed_map: changed map
   :return: confusion matrix and overall accuracy
   
Methodology/util/acc_ass.py