Exemple #1
0
def execute_smk_L3(annots_df, qaid, invindex, qparams, withinfo=True):
    """
    Executes a single smk query

    Example:
        >>> from ibeis.algo.hots.smk.smk_match import *  # NOQA
        >>> from ibeis.algo.hots.smk import smk_debug
        >>> ibs, annots_df, daids, qaids, invindex, qreq_ = smk_debug.testdata_internals_full()
        >>> qaid = qaids[0]
        >>> qparams = qreq_.qparams
        >>> withinfo = True
        >>> daid2_totalscore, daid2_chipmatch = execute_smk_L3(annots_df, qaid, invindex, qparams, withinfo)
    """
    #from ibeis.algo.hots.smk import smk_index
    # Get query words / residuals
    qindex = smk_repr.new_qindex(annots_df, qaid, invindex, qparams)
    # Compute match kernel for all database aids
    daid2_totalscore, daid2_chipmatch = smk_core.match_kernel_L2(
        qindex, invindex, qparams, withinfo)  # 54 %
    # Prevent self matches
    allow_self_match = qparams.allow_self_match
    #ut.get_argflag('--self-match')
    if (not allow_self_match) and qaid in daid2_totalscore:
        # If we cannot do self-matches
        daid2_totalscore[qaid] = 0
        daid2_chipmatch[0][qaid] = np.empty((0, 2), dtype=np.int32)
        daid2_chipmatch[1][qaid] = np.empty((0), dtype=np.float32)
        daid2_chipmatch[2][qaid] = np.empty((0), dtype=np.int32)
    # Build chipmatches if daid2_wx2_scoremat is not None
    if DEBUG_SMK:
        from ibeis.algo.hots.smk import smk_debug
        smk_debug.check_daid2_chipmatch(daid2_chipmatch)
    return daid2_totalscore, daid2_chipmatch
Exemple #2
0
def execute_smk_L3(annots_df, qaid, invindex, qparams, withinfo=True):
    """
    Executes a single smk query

    Example:
        >>> from ibeis.algo.hots.smk.smk_match import *  # NOQA
        >>> from ibeis.algo.hots.smk import smk_debug
        >>> ibs, annots_df, daids, qaids, invindex, qreq_ = smk_debug.testdata_internals_full()
        >>> qaid = qaids[0]
        >>> qparams = qreq_.qparams
        >>> withinfo = True
        >>> daid2_totalscore, daid2_chipmatch = execute_smk_L3(annots_df, qaid, invindex, qparams, withinfo)
    """
    #from ibeis.algo.hots.smk import smk_index
    # Get query words / residuals
    qindex = smk_repr.new_qindex(annots_df, qaid, invindex, qparams)
    # Compute match kernel for all database aids
    daid2_totalscore, daid2_chipmatch = smk_core.match_kernel_L2(qindex, invindex, qparams, withinfo)  # 54 %
    # Prevent self matches
    allow_self_match = qparams.allow_self_match
    #ut.get_argflag('--self-match')
    if (not allow_self_match) and qaid in daid2_totalscore:
        # If we cannot do self-matches
        daid2_totalscore[qaid] = 0
        daid2_chipmatch[0][qaid] = np.empty((0, 2), dtype=np.int32)
        daid2_chipmatch[1][qaid] = np.empty((0), dtype=np.float32)
        daid2_chipmatch[2][qaid] = np.empty((0), dtype=np.int32)
    # Build chipmatches if daid2_wx2_scoremat is not None
    if DEBUG_SMK:
        from ibeis.algo.hots.smk import smk_debug
        smk_debug.check_daid2_chipmatch(daid2_chipmatch)
    return daid2_totalscore, daid2_chipmatch
Exemple #3
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 #4
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