gt_list = [] map_name = ['1920-1.png', '1920-2.png', '1920-3.png', '1920-4.png', '1920-5.png', '1920-6.png', '1920-7.png', '1920-8.png', '1920-9.png', '1920-10.png'] found_gt_num = 0 correct_num = 0 discard_num = 0 strabo_num = 0 for m in range(1, 11): groundTruthFile = './GroundTruths/' + map_name[m-1].split('.')[0] + '.geojson' result_file = './rsh_rs/' + map_name[m-1] + 'ByPixels.txt' result_obj = GeoJsonReader.load_json_file(result_file) result_rect_list = GeoJsonReader.get_result_rectangles(result_obj) gt_obj = GeoJsonReader.load_json_file(groundTruthFile) gt_list = GeoJsonReader.get_ground_truth_list(gt_obj, 1, 1) word_locations = map_words_locations[m] for idw, rect in enumerate(word_locations): word_list = map_aligned_list[m][idw] discard_list = map_discard_list[m][idw] result_text = '' rect_idx = 0 for result_rect in result_rect_list: if result_rect.is_the_same_rect(rect): result_text = result_rect.text break
def evaluate_result(gt_obj, result_obj, group_para=0, scale_w=1, scale_h=1): gt_list = GeoJsonReader.get_ground_truth_list(gt_obj, scale_w, scale_h) result_rect_list = GeoJsonReader.get_result_rectangles(result_obj) return ResultEvaluation.evaluation_simple(result_rect_list, gt_list, area_threshold=0.7, group_para=group_para)