def test_query(self): s = Searcher('search_engine_nyk.sql') #self.assertEqual(s.query('AOAPAPA'), []) #print(s.query('love')[:1]) #print(s.query('Mad Men')) #self.assertEqual(s.query('Mad Men'), []) pass
from tracker_engine.tracker import TrackerMulti from worker import handle_missing_object, save_image_product from model import * from sqlalchemy import func from flask_jwt_extended import create_access_token, verify_jwt_in_request, current_user, get_jwt, jwt_required from functools import wraps import base64 import io import numpy as np import re # Global param detector = Detector() extractor = Extractor() searcher = Searcher() # extractor = None # searcher = None # detector = None tracker = TrackerMulti() ######################## User API ######################## # Utilities @jwt.user_identity_loader def user_identity_lookup(user): # Convert object to JSON serializable format for token return user.username
def test_normalize_scores(self): s = Searcher('abc.db') self.assertEqual(s.normalize_scores({}, 1), {}) self.assertEqual(s.normalize_scores({}, 0), {})
def test_inbound_scores(self): s = Searcher('nyw.sql') s.calculate_page_rank() self.assertNotEqual(s.inbound_link_scores({}), {})
def test_distance_scores(self): s = Searcher('abc.db') self.assertEqual(s.distance_scores({}), {})
ap.add_argument("-i", "--index", required=True, help="Path to where the computed index will be stored") ap.add_argument("-q", "--query", required=True, help="Path to the query image") ap.add_argument("-r", "--result-path", required=True, help="Path to the result path") args = vars(ap.parse_args()) # initialize the image descriptor cd = ColorDescriptor((8, 12, 3)) # load the query image and describe it query = cv2.imread(args["query"]) features = cd.describe(query) # perform the search searcher = Searcher(args["index"]) results = searcher.search(features) # display the query cv2.imshow("Query", query) # loop over the results for (score, resultID) in results: # load the result image and display it result = cv2.imread(args["result_path"] + "/" + resultID) cv2.imshow("Result", result) cv2.waitKey(0)