def test_sccw_cache(): ibs, annots_df, taids, daids, qaids, qreq_, nWords = testdata_dataframe() smk_alpha = ibs.cfg.query_cfg.smk_cfg.smk_alpha smk_thresh = ibs.cfg.query_cfg.smk_cfg.smk_thresh qparams = qreq_.qparams words = smk_index.learn_visual_words(annots_df, taids, nWords) with_internals = True invindex = smk_repr.index_data_annots(annots_df, daids, words, qparams, with_internals) idx2_daid = invindex.idx2_daid wx2_drvecs = invindex.wx2_drvecs wx2_idf = invindex.wx2_idf wx2_aids = invindex.wx2_aids wx2_dmaws = invindex.wx2_dmaws daids = invindex.daids daid2_sccw1 = smk_index.compute_data_sccw_(idx2_daid, wx2_drvecs, wx2_aids, wx2_idf, wx2_dmaws, smk_alpha, smk_thresh, use_cache=True) daid2_sccw2 = smk_index.compute_data_sccw_(idx2_daid, wx2_drvecs, wx2_aids, wx2_idf, wx2_dmaws, smk_alpha, smk_thresh, use_cache=False) daid2_sccw3 = smk_index.compute_data_sccw_(idx2_daid, wx2_drvecs, wx2_aids, wx2_idf, wx2_dmaws, smk_alpha, smk_thresh, use_cache=True) check_daid2_sccw(daid2_sccw1) check_daid2_sccw(daid2_sccw2) check_daid2_sccw(daid2_sccw3) if not np.all(daid2_sccw2 == daid2_sccw3): raise AssertionError('caching error in sccw') if not np.all(daid2_sccw1 == daid2_sccw2): raise AssertionError('cache outdated in sccw')
def testdata_words(**kwargs): from ibeis.algo.hots.smk import smk_debug ibs, annots_df, taids, daids, qaids, qreq_, nWords = smk_debug.testdata_dataframe( **kwargs) print('[smk_debug] testdata_words') words = smk_index.learn_visual_words(annots_df, qreq_) return ibs, annots_df, daids, qaids, qreq_, words
def prepare_qreq(qreq_, annots_df, memtrack): """ Called if pipeline did not setup qreq correctly """ print('\n\n+--- QREQ NEEDS TO LOAD VOCAB --- ') if hasattr(qreq_, 'words'): # Hack raise NotImplementedError('pipeline still isnt fully ready for smk') words = qreq_.words invindex = qreq_.invindex else: # Load vocabulary qparams = qreq_.qparams daids = qreq_.get_external_daids() words = smk_index.learn_visual_words(annots_df, qreq_, memtrack=memtrack) memtrack.report('[SMK LEARN VWORDS]') # Index database annotations with_internals = True invindex = smk_repr.index_data_annots(annots_df, daids, words, qparams, with_internals, memtrack) memtrack.report('[SMK INDEX ANNOTS]') print('L___ FINISHED LOADING VOCAB ___\n') return words, invindex
def testdata_words(**kwargs): from ibeis.algo.hots.smk import smk_debug ibs, annots_df, taids, daids, qaids, qreq_, nWords = smk_debug.testdata_dataframe(**kwargs) print('[smk_debug] testdata_words') words = smk_index.learn_visual_words(annots_df, qreq_) return ibs, annots_df, daids, qaids, qreq_, words