예제 #1
0
 def __init__(self):
     with open('vocabulary-new.pkl', 'rb') as f:
         self.voc = pickle.load(f)
     url = 'static/'
     self.imlist = vocabulary.get_img_list(url)
     self.feature = vocabulary.get_feature_list(url)
     self.nbr_images = len(self.imlist)
     self.ndx = range(self.nbr_images)
     self.maxres = 15
     self.header = """
         <!doctype html>
         <head>
         <title>Image search</title>
         </head>
         <body>
         """
     self.footer = """
예제 #2
0
 def __init__(self):
     with open('vocabulary-new.pkl', 'rb') as f:
         self.voc = pickle.load(f)
     url = 'static/'
     self.imlist = vocabulary.get_img_list(url)
     self.feature = vocabulary.get_feature_list(url)
     self.nbr_images = len(self.imlist)
     self.ndx = range(self.nbr_images)
     self.maxres = 15
     self.header = """
         <!doctype html>
         <head>
         <title>Image search</title>
         </head>
         <body>
         """
     self.footer = """
예제 #3
0
    # indx.db_commit()
    #
    # src = Searcher('/home/aurora/hdd/workspace/PycharmProjects/test.db', voc)
    src = Searcher('test.db', voc)
    # locs, descr = sift.read_feature_from_file(url+'ukbench00432.sift')
    # iw = src.voc.project(descr)
    # # index = range(0, iw.shape[0], 1)
    # # figure, ax = plt.subplots()
    # # ax.scatter(index, iw)
    # # plt.show()
    #
    # print 'ask using a histogram...'
    # print src.candidates_from_histogram(iw)[:10]

    # print 'try a query...'
    # print src.query(url+'ukbench00000.jpg')[:4]

    imlists = vocabulary.get_img_list(url)
    # images = imlists
    # print images
    # results = compute_ukbench_score(src, images)
    # print results

    nbr_results = 6
    res = [w[1] for w in src.query(imlists[0])[:nbr_results]]
    plot_results(src, res)
    # test file match
    # imlists = vocabulary.get_img_list(url)
    # features_lists = vocabulary.get_feature_list(url)
    # files = [(w[-17:], d[-16:]) for w, d in zip(imlists, features_lists)]
    # print files
예제 #4
0
    # indx.db_commit()
    #
    # src = Searcher('/home/aurora/hdd/workspace/PycharmProjects/test.db', voc)
    src = Searcher('test.db', voc)
    # locs, descr = sift.read_feature_from_file(url+'ukbench00432.sift')
    # iw = src.voc.project(descr)
    # # index = range(0, iw.shape[0], 1)
    # # figure, ax = plt.subplots()
    # # ax.scatter(index, iw)
    # # plt.show()
    #
    # print 'ask using a histogram...'
    # print src.candidates_from_histogram(iw)[:10]

    # print 'try a query...'
    # print src.query(url+'ukbench00000.jpg')[:4]

    imlists = vocabulary.get_img_list(url)
    # images = imlists
    # print images
    # results = compute_ukbench_score(src, images)
    # print results

    nbr_results = 6
    res = [w[1] for w in src.query(imlists[0])[:nbr_results]]
    plot_results(src, res)
    # test file match
    # imlists = vocabulary.get_img_list(url)
    # features_lists = vocabulary.get_feature_list(url)
    # files = [(w[-17:], d[-16:]) for w, d in zip(imlists, features_lists)]
    # print files