Exemple #1
0
def testdata_match_kernel_L2(**kwargs):
    """
    Example:
        >>> from ibeis.algo.hots.smk.smk_debug import *  # NOQA
    """
    from ibeis.algo.hots.smk import smk_debug
    ibs, annots_df, daids, qaids, invindex, qreq_ = smk_debug.testdata_internals_full(**kwargs)
    print('[smk_debug] testdata_match_kernel_L2')
    qparams = qreq_.qparams
    qaid = qaids[0]
    qindex = smk_repr.new_qindex(annots_df, qaid, invindex, qparams)
    return ibs, invindex, qindex, qparams
Exemple #2
0
def testdata_match_kernel_L2(**kwargs):
    """
    Example:
        >>> from ibeis.algo.hots.smk.smk_debug import *  # NOQA
    """
    from ibeis.algo.hots.smk import smk_debug
    ibs, annots_df, daids, qaids, invindex, qreq_ = smk_debug.testdata_internals_full(
        **kwargs)
    print('[smk_debug] testdata_match_kernel_L2')
    qparams = qreq_.qparams
    qaid = qaids[0]
    qindex = smk_repr.new_qindex(annots_df, qaid, invindex, qparams)
    return ibs, invindex, qindex, qparams
Exemple #3
0
def smk_plots_main():
    """
    smk
    python smk_plots.py --db PZ_MTEST --notoolbar

    CommandLine:
        python -m ibeis.algo.hots.smk.smk_plots --test-smk_plots_main
        python -m ibeis.algo.hots.smk.smk_plots --test-smk_plots_main --db PZ_MTEST --notoolbar

    Example:
        >>> # DISABLE_DOCTEST
        >>> from ibeis.algo.hots.smk.smk_plots import *  # NOQA
        >>> smk_plots_main()
    """
    from ibeis.algo.hots.smk import smk_plots
    import utool as ut
    #from plottool import draw_func2 as df2
    kwargs = {
        #'db': 'GZ_ALL',
        #'db': 'PZ_MTEST',
        'db': ut.get_argval('--db', str, default='testdb1'),
        'nWords': ut.get_argval('--nWords', int, default=8000),
        'delete_rawvecs': False,
    }
    (ibs, annots_df, daids, qaids, invindex,
     qreq_) = smk_debug.testdata_internals_full(**kwargs)
    kwargs = {}
    aid = 3
    #try:
    #    testdata = ('metrics',)
    #    metrics = ut.load_testdata(*testdata)
    #except Exception as ex:
    metrics = smk_plots.compute_word_metrics(invindex)
    #ut.save_testdata(*testdata)
    valid_aids = ibs.get_valid_aids()

    # HACK
    if ibs.get_dbname().startswith('GZ_'):
        ibs.cfg.detect_cfg.species_text = 'zebra_grevys'
    else:
        ibs.cfg.detect_cfg.species_text = 'zebra_plains'

    # Define the plots you want

    startx = ut.get_argval(('--startx', '--x'),
                           int,
                           default=min(18,
                                       len(valid_aids) - 1))

    for aid in ut.InteractiveIter(valid_aids, startx=startx):
        #df2.rrr()
        #smk_plots.rrr()
        print('[smk_plot] visualizing annotation aid=%r' % (aid, ))
        kwargs = smk_plots.main_options()
        qres_list = []
        qfx2_closest_k_list = []
        K_list = kwargs.pop('K_list')
        for K in K_list:
            qres, qfx2_closest_k = smk_plots.get_qres_and_closest_valid_k(ibs,
                                                                          aid,
                                                                          K=K)
            qres_list.append(qres)
            qfx2_closest_k_list.append(qfx2_closest_k)
        smk_plots.viz_annot_with_metrics(
            ibs,
            invindex,
            aid,
            metrics,
            qfx2_closest_k_list=qfx2_closest_k_list,
            qres_list=qres_list,
            **kwargs)
        smk_plots.present()
Exemple #4
0
def smk_plots_main():
    """
    smk
    python smk_plots.py --db PZ_MTEST --notoolbar

    CommandLine:
        python -m ibeis.algo.hots.smk.smk_plots --test-smk_plots_main
        python -m ibeis.algo.hots.smk.smk_plots --test-smk_plots_main --db PZ_MTEST --notoolbar

    Example:
        >>> # DISABLE_DOCTEST
        >>> from ibeis.algo.hots.smk.smk_plots import *  # NOQA
        >>> smk_plots_main()
    """
    from ibeis.algo.hots.smk import smk_plots
    import utool as ut
    #from plottool import draw_func2 as df2
    kwargs = {
        #'db': 'GZ_ALL',
        #'db': 'PZ_MTEST',
        'db': ut.get_argval('--db', str, default='testdb1'),
        'nWords': ut.get_argval('--nWords', int, default=8000),
        'delete_rawvecs': False,
    }
    (ibs, annots_df, daids, qaids, invindex, qreq_) = smk_debug.testdata_internals_full(**kwargs)
    kwargs = {}
    aid = 3
    #try:
    #    testdata = ('metrics',)
    #    metrics = ut.load_testdata(*testdata)
    #except Exception as ex:
    metrics = smk_plots.compute_word_metrics(invindex)
    #ut.save_testdata(*testdata)
    valid_aids =  ibs.get_valid_aids()

    # HACK
    if ibs.get_dbname().startswith('GZ_'):
        ibs.cfg.detect_cfg.species_text = 'zebra_grevys'
    else:
        ibs.cfg.detect_cfg.species_text = 'zebra_plains'

    # Define the plots you want

    startx = ut.get_argval(('--startx', '--x'), int, default=min(18, len(valid_aids) - 1))

    for aid in ut.InteractiveIter(valid_aids, startx=startx):
        #df2.rrr()
        #smk_plots.rrr()
        print('[smk_plot] visualizing annotation aid=%r' % (aid,))
        kwargs = smk_plots.main_options()
        qres_list = []
        qfx2_closest_k_list = []
        K_list = kwargs.pop('K_list')
        for K in K_list:
            qres, qfx2_closest_k = smk_plots.get_qres_and_closest_valid_k(ibs, aid, K=K)
            qres_list.append(qres)
            qfx2_closest_k_list.append(qfx2_closest_k)
        smk_plots.viz_annot_with_metrics(ibs, invindex, aid, metrics,
                                         qfx2_closest_k_list=qfx2_closest_k_list,
                                         qres_list=qres_list, **kwargs)
        smk_plots.present()