提交 9ea8a47c 编写于 作者: 文幕地方's avatar 文幕地方

support eval in less det resule

上级 a5dbd8bb
...@@ -15,13 +15,12 @@ ...@@ -15,13 +15,12 @@
import os import os
import re import re
import sys import sys
# import Polygon
import shapely import shapely
from shapely.geometry import Polygon from shapely.geometry import Polygon
import numpy as np import numpy as np
from collections import defaultdict from collections import defaultdict
import operator import operator
import editdistance import Levenshtein
import argparse import argparse
import json import json
import copy import copy
...@@ -95,7 +94,7 @@ def ed(args, str1, str2): ...@@ -95,7 +94,7 @@ def ed(args, str1, str2):
if args.ignore_case: if args.ignore_case:
str1 = str1.lower() str1 = str1.lower()
str2 = str2.lower() str2 = str2.lower()
return editdistance.eval(str1, str2) return Levenshtein.distance(str1, str2)
def convert_bbox_to_polygon(bbox): def convert_bbox_to_polygon(bbox):
...@@ -115,7 +114,9 @@ def eval_e2e(args): ...@@ -115,7 +114,9 @@ def eval_e2e(args):
# pred # pred
dt_results = parse_ser_results_fp(args.pred_json_path, "pred", dt_results = parse_ser_results_fp(args.pred_json_path, "pred",
args.ignore_background) 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 iou_thresh = args.iou_thres
num_gt_chars = 0 num_gt_chars = 0
...@@ -124,7 +125,7 @@ def eval_e2e(args): ...@@ -124,7 +125,7 @@ def eval_e2e(args):
hit = 0 hit = 0
ed_sum = 0 ed_sum = 0
for img_name in gt_results: for img_name in dt_results:
gt_info = gt_results[img_name] gt_info = gt_results[img_name]
gt_count += len(gt_info) gt_count += len(gt_info)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册