proceed_sets = set()

    score_writer = csv.DictWriter(scorefile, fieldnames=fieldnames2)
    score_writer.writeheader()

    rect_writer = csv.DictWriter(rect_precision_file, fieldnames=fieldnames)
    rect_writer.writeheader()

    # Read Ground Truth.
    map_gt_list = [];
    for m in range(1, 11):
        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']

        groundTruthFile = './GroundTruths/' + map_name[m - 1].split('.')[0] + '.geojson'
        gt_obj = GeoJsonReader.load_json_file(groundTruthFile)
        gt_list = GeoJsonReader.get_ground_truth_list(gt_obj, 1, 1)
        map_gt_list.append(gt_list)

    candidate_file = './narges result/candidates'
    cf = open(candidate_file, 'r')

    map_feature_list = []
    map_result_obj_features = []
    map_result_feature_count = []
    map_result_rects = []

    # Read result files.
    count = 0
    for i in range(1, MAP_NUM):
        result_file_name = './narges result/1920-' + str(i) + '.png_EdditedByPixels.txt'
from Evaluation import GeoJsonReader
import csv


if __name__ == '__main__':
    csv_output = open('narges_original_text.csv', 'wt');
    csv_writer = csv.writer(csv_output)

    count = 0
    for i in range(1, 11):
        result_file_name = './narges result/1920-' + str(i) + '.png_EdditedByPixels.txt'
        result_obj = GeoJsonReader.load_json_file(result_file_name)


        for feature in result_obj['features']:
            text = feature['NameBeforeDictionary']
            text.replace(',', '')
            text.replace('\n', ' ')
            csv_writer.writerow([text])
            count += 1
    writer.writeheader()

    csvwrite2 = open('Log2.csv', 'w')
    writer2 = csv.DictWriter(csvwrite2, fieldnames=fieldnames)
    writer2.writeheader()

    for i in range(0, 10):
        mn = map_name[i]
        print('eval ', mn)
        with open('./scores.csv') as csvfile:
            reader = csv.reader(csvfile, delimiter=',', quotechar='|')

            prev_result_file = './rsh_rs/' + map_name[i] + 'ByPixels.txt'
            groundTruthFile = './GroundTruths/' + map_name[i].split('.')[0] + '.geojson'

            prev_result_obj = GeoJsonReader.load_json_file(prev_result_file)
            gt_obj = GeoJsonReader.load_json_file(groundTruthFile)

            gt_list = GeoJsonReader.get_ground_truth_list(gt_obj, 1, 1)
            prev_result_rect_list = GeoJsonReader.get_result_rectangles(prev_result_obj)

            print('First eval')
            overlap_json, non_overlap_json, precision_list, recall_list, extracted_num_list, gt_num_list = \
            ResultEvaluation.evaluation_simple(prev_result_rect_list, gt_list, area_threshold=0.6, group_para=0)

            # final_list = []
            delete_list = []

            for j, rect in enumerate(prev_result_rect_list):
                found_reverse = False
                for k, rect2 in enumerate(prev_result_rect_list):