def calculate_category_accuracy(cats):
    conf = {'TN': np.zeros(shape=(NUM_ACC_PASSES, 1)), 'TP': np.zeros(shape=(NUM_ACC_PASSES, 1)), 'FN': np.zeros(shape=(NUM_ACC_PASSES, 1)), 'FP': np.zeros(shape=(NUM_ACC_PASSES, 1))}
    for (key, values) in cats.items():
        correct = values[0]
        wrong = values[1]
        if (key == 'normal'):
            (correct, wrong) = (wrong, correct)
            conf['TN'] += correct
            conf['FP'] += wrong
        else:
            conf['TP'] += correct
            conf['FN'] += wrong
        avg = (correct / (correct + wrong))
        cats[key] = [avg.mean(), avg.std()]
    return conf
def calculate_category_accuracy(cats):
    conf = {'TN': np.zeros(shape=(NUM_ACC_PASSES, 1)), 'TP': np.zeros(shape=(NUM_ACC_PASSES, 1)), 'FN': np.zeros(shape=(NUM_ACC_PASSES, 1)), 'FP': np.zeros(shape=(NUM_ACC_PASSES, 1))}
    for (key, values) in cats.items():
        correct = values[0]
        wrong = values[1]
        if (key == 'normal'):
            (correct, wrong) = (wrong, correct)
            conf['TN'] += correct
            conf['FP'] += wrong
        else:
            conf['TP'] += correct
            conf['FN'] += wrong
        avg = (correct / (correct + wrong))
        cats[key] = [avg.mean(), avg.std()]
    return conf