Exemple #1
0
        test_cv_preds = test_cv_preds.iloc[:, 3:].values.reshape(
            len(test_cv_preds), -1, 4)
        predictions = predictions.reshape(-1, 240, order='A')
        predictions = predictions.reshape(-1, 4, 60)

        predictions = utils.xywh_to_x1y1x2y2(predictions)
        predictions = np.swapaxes(predictions, 1, 2)

        predictions = np.around(predictions).astype(int)

        predictions = test_cv_preds - predictions

        gt_df = pd.read_csv('./outputs/ground_truth/test_' + detector +
                            '_fold_' + str(fold) + '.csv')
        gt_boxes = gt_df.iloc[:, 3:].values.reshape(len(gt_df), -1, 4)
        aiou = utils.calc_aiou(gt_boxes, predictions)
        fiou = utils.calc_fiou(gt_boxes, predictions)
        print('AIOU: ', round(aiou * 100, 1))
        print('FIOU: ', round(fiou * 100, 1))

        print('Saving predictions to ./outputs/sted/test_' + detector +
              '_fold_' + str(fold) + '.csv')

        for i in range(1, 61):
            results_df['x1_' + str(i)] = predictions[:, i - 1, 0]
            results_df['y1_' + str(i)] = predictions[:, i - 1, 1]
            results_df['x2_' + str(i)] = predictions[:, i - 1, 2]
            results_df['y2_' + str(i)] = predictions[:, i - 1, 3]

        results_df.to_csv('./outputs/sted/test_' + detector + '_fold_' +
                          str(fold) + '.csv',
Exemple #2
0
    fious = []
    ades = []
    fdes = []
    for fold in [1, 2, 3]:

        gt_df = pd.read_csv(args.gt + '/test_' + detector + '_fold_' +
                            str(fold) + '.csv')
        pred_df = pd.read_csv(args.pred + '/test_' + detector + '_fold_' +
                              str(fold) + '.csv')

        gt_boxes = gt_df[box_names].values.reshape(len(gt_df), -1, 4)
        pred_boxes = pred_df[box_names].values.reshape(len(pred_df), -1, 4)

        ade = utils.calc_ade(gt_boxes, pred_boxes)
        fde = utils.calc_fde(gt_boxes, pred_boxes)
        aiou = utils.calc_aiou(gt_boxes, pred_boxes)
        fiou = utils.calc_fiou(gt_boxes, pred_boxes)

        aious.append(aiou)
        fious.append(fiou)
        ades.append(ade)
        fdes.append(fde)

        print()
        print(detector + ' fold ' + str(fold))
        print('AIOU: ', round(aiou * 100, 1))
        print('FIOU: ', round(fiou * 100, 1))
        print('ADE:  ', round(ade, 1))
        print('FDE:  ', round(fde, 1))

    print()