Пример #1
0
 def __init__(hs, args=None, db_dir=None):
     super(HotSpotter, hs).__init__(child_exclude_list=['prefs', 'args'])
     #printDBG('[\hs] Creating HotSpotter API')
     # TODO Remove args / integrate into prefs
     hs.args = args
     hs.callbacks = {}
     hs.tables = None
     hs.dirs = None
     hs.feats = ds.HotspotterChipFeatures()
     hs.cpaths = ds.HotspotterChipPaths()
     #
     hs.train_sample_cx = None
     hs.test_sample_cx = None
     hs.indexed_sample_cx = None
     #
     pref_fpath = join(io.GLOBAL_CACHE_DIR, 'prefs')
     hs.prefs = Pref('root', fpath=pref_fpath)
     if hs.args.nocache_prefs:
         hs.default_preferences()
     else:
         hs.load_preferences()
     #if args is not None:
     #hs.prefs.N = args.N if args is not None
     #args_dict = vars(args)
     #hs.update_preferences(**args_dict)
     hs.query_history = [(None, None)]
     hs.qdat = ds.QueryData()  # Query Data
     if db_dir is not None:
         hs.load_tables(db_dir=db_dir)
Пример #2
0
def prequery(hs):
    query_cfg = hs.prefs.query_cfg
    if hs.qdat is None:
        hs.qdat = ds.QueryData()
    hs.qdat.set_cfg(query_cfg)
    if query_cfg.agg_cfg.query_type == 'vsmany':
        dcxs = hs.get_indexed_sample()
        ensure_nn_index(hs, hs.qdat, dcxs)