From 9ea8a47c97672e3aad904fe7acb6618374ddbc13 Mon Sep 17 00:00:00 2001 From: WenmuZhou <572459439@qq.com> Date: Sat, 18 Dec 2021 12:48:00 +0000 Subject: [PATCH] support eval in less det resule --- ppstructure/vqa/helper/eval_with_label_end2end.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/ppstructure/vqa/helper/eval_with_label_end2end.py b/ppstructure/vqa/helper/eval_with_label_end2end.py index c8dd3e0a..4cc708ac 100644 --- a/ppstructure/vqa/helper/eval_with_label_end2end.py +++ b/ppstructure/vqa/helper/eval_with_label_end2end.py @@ -15,13 +15,12 @@ import os import re import sys -# import Polygon import shapely from shapely.geometry import Polygon import numpy as np from collections import defaultdict import operator -import editdistance +import Levenshtein import argparse import json import copy @@ -95,7 +94,7 @@ def ed(args, str1, str2): if args.ignore_case: str1 = str1.lower() str2 = str2.lower() - return editdistance.eval(str1, str2) + return Levenshtein.distance(str1, str2) def convert_bbox_to_polygon(bbox): @@ -115,7 +114,9 @@ def eval_e2e(args): # pred dt_results = parse_ser_results_fp(args.pred_json_path, "pred", args.ignore_background) - assert set(gt_results.keys()) == set(dt_results.keys()) + # print(gt_results.keys()) + # print(dt_results.keys()) + # assert set(gt_results.keys()) == set(dt_results.keys()) iou_thresh = args.iou_thres num_gt_chars = 0 @@ -124,7 +125,7 @@ def eval_e2e(args): hit = 0 ed_sum = 0 - for img_name in gt_results: + for img_name in dt_results: gt_info = gt_results[img_name] gt_count += len(gt_info) -- GitLab