import h5py import numpy as np rmac_out_file = '/media/Data/data/beni_culturali/out/rmac_out.txt' orb_out_file = '/media/Data/data/beni_culturali/out/orb_out.txt' ground_truth_file = '/media/Data/data/beni_culturali/groundtruth.txt' ground_truth = {} rmac_out = {} orb_out = {} query_folder = '/media/Data/data/beni_culturali/ImmaginiComparazioni/' img_folder = '/media/Data/data/beni_culturali/thumbs/' with open(ground_truth_file, 'r') as f: for line in f: values = line.strip().split(',') ground_truth[values[0]] = values[1:] with open(orb_out_file, 'r') as f: for line in f: values = line.strip().split(',') orb_out[values[0]] = values[1] with open(rmac_out_file, 'r') as f: for line in f: values = line.strip().split(',') rmac_out[values[0]] = values[1:] counter = 0 found = 0 html = '' html += '

Image Analysis Report

' html += '

Numero totale query: 64 (una query รจ ripetuta due volte)

' html += '

Immagini Recuperate (evidenziate dal bordo verde):

' html += '' html += '

Elenco delle query e delle immagini recuperate:

' html += '

[query, immagine ritrovata, posizione (ranking)]


' counter = 1 for key, value in ground_truth.items(): orb_res = orb_out[key] rmac_res = rmac_out[key] #print(key) #print(value) # print(orb_res + '\n') html += '
' + str(counter) + '. ' + key + '' tmp = '' found_id = '' found = False k = 0 if orb_res in value: found = True found_id = orb_res ground_truth[key] = 'already_found' tmp += '' else: for k in range(60): if rmac_res[k] in value: tmp += '' found = True found_id = rmac_res[k] ground_truth[key] = 'already_found' break if k < 2: tmp += '' else: tmp += '.' if found: html += ', ' + found_id + '' + ', (ranking: ' + str(k + 1) + ')' else: html += ', NONE' html += '

' if found: html += tmp else: html += '' html += '

' counter += 1 html += '' print(html)