def benchmark_knn(): r""" CommandLine: python ~/code/ibeis/ibeis/algo/hots/tests/bench.py benchmark_knn --profile Example: >>> # DISABLE_DOCTEST >>> from bench import * # NOQA >>> result = benchmark_knn() >>> print(result) """ from ibeis.algo.hots import _pipeline_helpers as plh from ibeis.algo.hots.pipeline import nearest_neighbors import ibeis verbose = True qreq_ = ibeis.testdata_qreq_( defaultdb='PZ_PB_RF_TRAIN', t='default:K=3,requery=True,can_match_samename=False', a='default:qsize=100', verbose=1) locals_ = plh.testrun_pipeline_upto(qreq_, 'nearest_neighbors') Kpad_list, impossible_daids_list = ut.dict_take( locals_, ['Kpad_list', 'impossible_daids_list']) nns_list1 = nearest_neighbors(qreq_, Kpad_list, impossible_daids_list, verbose=verbose)
def _compute_svvars(ibs, aid1): """ If spatial-verfication dbginfo is not in we need to compute it """ from ibeis.algo.hots import _pipeline_helpers as plh from ibeis.algo.hots import query_request daids = ibs.get_valid_aids() qaids = [aid1] cfgdict = dict(with_metadata=True) qreq_ = query_request.new_ibeis_query_request(ibs, qaids, daids, cfgdict) assert len(daids) > 0, '!!! nothing to search' assert len(qaids) > 0, '!!! nothing to query' qreq_.lazy_load() pipeline_locals_ = plh.testrun_pipeline_upto(qreq_, None) qaid2_chipmatch_FILT = pipeline_locals_['qaid2_chipmatch_FILT'] qaid2_svtups = qreq_.metadata['qaid2_svtups'] chipmatch_FILT = qaid2_chipmatch_FILT[aid1] aid2_svtup = qaid2_svtups[aid1] return chipmatch_FILT, aid2_svtup