Ejemplo n.º 1
0
    def search_SIFT_BOVW(returnCount=100,
                         mySIFTmodel=mySIFTmodel,
                         mySIFTtree=mySIFTtree,
                         mydataSIFT=mydataSIFT,
                         txt='',
                         write=False):
        imagematches, searchtime = ImageSearch_Algo_SIFT.SIFT_SEARCH_TREE(
            q_path,
            mySIFTmodel,
            mySIFTtree,
            mydataSIFT,
            returnCount=returnCount,
            kp=100)
        if write:
            a, d, ind, cnt = accuracy.accuracy_matches(q_path, imagematches,
                                                       ACCURRACY_RANGE)
            # print ('Accuracy =',  a, '%', '| Quality:', d )
            # print ('Count', cnt, ' | position', ind)
            row_dict['acc_sift_tree' + txt] = a
            row_dict['index_sift_tree' + txt] = ind
            row_dict['Count_sift_tree' + txt] = cnt
            row_dict['quality_sift_tree' + txt] = d
            row_dict['time_sift_tree' + txt] = searchtime

        return imagematches, searchtime
Ejemplo n.º 2
0
# ----- Alternative tree search code [Optimized search time ]

# test SIFT TREE SEARCH code
n_clusters = 500
savefile = 'data/' + 'test' + '_SIFT_Tree_Cluster' + str(n_clusters)
SIFTtree, SIFTmodel = ImageSearch_Algo_SIFT.SIFT_CREATE_TREE_MODEL(
    mydataSIFT, savefile, n_clusters)

# to load an existing tree
thistree, thismodel = ImageSearch_Algo_SIFT.SIFT_Load_Tree_Model(savefile)

# sample 1 image
q_path = random.sample(imagepaths, 1)[0]

# Run Tree Search
imagematches, searchtime = ImageSearch_Algo_SIFT.SIFT_SEARCH_TREE(
    q_path, thismodel, thistree, mydataSIFT, returnCount=100, kp=100)
print('SIFT Tree Search time', searchtime)

a, q, pos, cnt = accuracy.accuracy_matches(q_path, imagematches, 20)
print('Accuracy =', a, '%', '| Quality:', q)
print('Count', cnt, ' | position', pos)

# BF Macher faster
imagematches, searchtime = ImageSearch_Algo_SIFT.SIFT_SEARCH_BF(
    mydataSIFT, q_path, sift_features_limit, 0.6, 50)
print(" SIFT BF Search time :", searchtime)
a, q, pos, cnt = accuracy.accuracy_matches(q_path, imagematches, 20)
print('Accuracy =', a, '%', '| Quality:', q)
print('Count', cnt, ' | position', pos)

# FLANN Macher (slower)