Esempio n. 1
0
 def get_infostr(qreq_):
     infostr_list = []
     app = infostr_list.append
     qaid_internal = qreq_.get_internal_qaids()
     daid_internal = qreq_.get_internal_daids()
     qd_intersection = ut.intersect_ordered(daid_internal, qaid_internal)
     app(' * len(internal_daids) = %r' % len(daid_internal))
     app(' * len(internal_qaids) = %r' % len(qaid_internal))
     app(' * len(qd_intersection) = %r' % len(qd_intersection))
     infostr = '\n'.join(infostr_list)
     return infostr
Esempio n. 2
0
 def get_infostr(qreq_):
     infostr_list = []
     app = infostr_list.append
     qaid_internal = qreq_.get_internal_qaids()
     daid_internal = qreq_.get_internal_daids()
     qd_intersection = ut.intersect_ordered(daid_internal, qaid_internal)
     app(' * len(internal_daids) = %r' % len(daid_internal))
     app(' * len(internal_qaids) = %r' % len(qaid_internal))
     app(' * len(qd_intersection) = %r' % len(qd_intersection))
     infostr = '\n'.join(infostr_list)
     return infostr
Esempio n. 3
0
def choose_vsmany_K(num_names, qaids, daids):
    """
    TODO: Should also scale up the number of checks as well

    method for choosing K in the initial vsmany queries

    Ignore:
        >>> # DISABLE_DOCTEST
        >>> # Shows plot for K vs number of names
        >>> from ibeis.algo.hots.automated_params import *  # NOQA
        >>> import ibeis
        >>> from ibeis import constants as const
        >>> ibs = ibeis.opendb(defaultdb='testdb1')
        >>> valid_aids = ibs.get_valid_aids(species=const.TEST_SPECIES.ZEB_PLAIN)
        >>> num_names = np.arange(0, 1000)
        >>> num_names_slope = .1
        >>> K_max = 10
        >>> K_min = 1
        >>> K_list = np.floor(num_names_slope * num_names)
        >>> K_list[K_list > K_max] = K_max
        >>> K_list[K_list < K_min] = K_min
        >>> clip_index_list = np.where(K_list >= K_max)[0]
        >>> clip_index = clip_index_list[min(len(clip_index_list) - 1, 10)]
        >>> K_list = K_list[0:clip_index]
        >>> num_names = num_names[0:clip_index]
        >>> pt.plot2(num_names, K_list, x_label='num_names', y_label='K',
        ...          equal_aspect=False, marker='g-', pad=1, dark=True)
        >>> pt.update()
    """
    #K = ibs.cfg.query_cfg.nn_cfg.K
    # TODO: paramaterize in config
    num_names_slope = .1  # increase K every fifty names
    K_max = 10
    K_min = 1
    num_names_lower = K_min / num_names_slope
    num_names_upper = K_max / num_names_slope
    if num_names < num_names_lower:
        K = K_min
    elif num_names < num_names_upper:
        K = num_names_slope * num_names
    else:
        K  = K_max

    with ut.embed_on_exception_context:
        if len(ut.intersect_ordered(qaids, daids)) > 0:
            # if self is in query bump k
            K += 1
    return K
Esempio n. 4
0
def choose_vsmany_K(num_names, qaids, daids):
    """
    TODO: Should also scale up the number of checks as well

    method for choosing K in the initial vsmany queries

    Ignore:
        >>> # DISABLE_DOCTEST
        >>> # Shows plot for K vs number of names
        >>> from ibeis.algo.hots.automated_params import *  # NOQA
        >>> import ibeis
        >>> from ibeis import constants as const
        >>> ibs = ibeis.opendb(defaultdb='testdb1')
        >>> valid_aids = ibs.get_valid_aids(species=const.TEST_SPECIES.ZEB_PLAIN)
        >>> num_names = np.arange(0, 1000)
        >>> num_names_slope = .1
        >>> K_max = 10
        >>> K_min = 1
        >>> K_list = np.floor(num_names_slope * num_names)
        >>> K_list[K_list > K_max] = K_max
        >>> K_list[K_list < K_min] = K_min
        >>> clip_index_list = np.where(K_list >= K_max)[0]
        >>> clip_index = clip_index_list[min(len(clip_index_list) - 1, 10)]
        >>> K_list = K_list[0:clip_index]
        >>> num_names = num_names[0:clip_index]
        >>> pt.plot2(num_names, K_list, x_label='num_names', y_label='K',
        ...          equal_aspect=False, marker='g-', pad=1, dark=True)
        >>> pt.update()
    """
    #K = ibs.cfg.query_cfg.nn_cfg.K
    # TODO: paramaterize in config
    num_names_slope = .1  # increase K every fifty names
    K_max = 10
    K_min = 1
    num_names_lower = K_min / num_names_slope
    num_names_upper = K_max / num_names_slope
    if num_names < num_names_lower:
        K = K_min
    elif num_names < num_names_upper:
        K = num_names_slope * num_names
    else:
        K = K_max

    with ut.embed_on_exception_context:
        if len(ut.intersect_ordered(qaids, daids)) > 0:
            # if self is in query bump k
            K += 1
    return K