当前位置: 首页>>代码示例>>Python>>正文


Python utool.get_list_column函数代码示例

本文整理汇总了Python中utool.get_list_column函数的典型用法代码示例。如果您正苦于以下问题:Python get_list_column函数的具体用法?Python get_list_column怎么用?Python get_list_column使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了get_list_column函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: group_review

def group_review():
    prefill = request.args.get('prefill', '')
    if len(prefill) > 0:
        ibs = current_app.ibs
        aid_list = ibs.get_valid_aids()
        bad_species_list, bad_viewpoint_list = ibs.validate_annot_species_viewpoint_cnn(aid_list)

        GROUP_BY_PREDICTION = True
        if GROUP_BY_PREDICTION:
            grouped_dict = ut.group_items(bad_viewpoint_list, ut.get_list_column(bad_viewpoint_list, 3))
            grouped_list = grouped_dict.values()
            regrouped_items = ut.flatten(ut.sortedby(grouped_list, map(len, grouped_list)))
            candidate_aid_list = ut.get_list_column(regrouped_items, 0)
        else:
            candidate_aid_list = [ bad_viewpoint[0] for bad_viewpoint in bad_viewpoint_list]
    elif request.args.get('aid_list', None) is not None:
        aid_list = request.args.get('aid_list', '')
        if len(aid_list) > 0:
            aid_list = aid_list.replace('[', '')
            aid_list = aid_list.replace(']', '')
            aid_list = aid_list.strip().split(',')
            candidate_aid_list = [ int(aid_.strip()) for aid_ in aid_list ]
        else:
            candidate_aid_list = ''
    else:
        candidate_aid_list = ''

    return appf.template(None, 'group_review', candidate_aid_list=candidate_aid_list, mode_list=appf.VALID_TURK_MODES)
开发者ID:Erotemic,项目名称:ibeis,代码行数:28,代码来源:routes.py

示例2: parse_items

    def parse_items(cfg):
        r"""
        Returns:
            list: param_list

        CommandLine:
            python -m dtool.base --exec-parse_items

        Example:
            >>> # ENABLE_DOCTEST
            >>> from dtool.base import *  # NOQA
            >>> from dtool.example_depcache import DummyVsManyConfig
            >>> cfg = DummyVsManyConfig()
            >>> param_list = cfg.parse_items()
            >>> result = ('param_list = %s' % (ut.repr2(param_list, nl=1),))
            >>> print(result)
        """
        namespace_param_list = cfg.parse_namespace_config_items()
        param_names = ut.get_list_column(namespace_param_list, 1)
        needs_namespace_keys = ut.find_duplicate_items(param_names)
        param_list = ut.get_list_column(namespace_param_list, [1, 2])
        # prepend namespaces to variables that need it
        for idx in ut.flatten(needs_namespace_keys.values()):
            name = namespace_param_list[idx][0]
            param_list[idx][0] = name + '_' + param_list[idx][0]
        duplicate_keys = ut.find_duplicate_items(ut.get_list_column(param_list, 0))
        # hack to let version through
        import utool
        with utool.embed_on_exception_context:
            assert len(duplicate_keys) == 0, (
                'Configs have duplicate names: %r' % duplicate_keys)
        return param_list
开发者ID:Erotemic,项目名称:dtool,代码行数:32,代码来源:base.py

示例3: get_name_rowid_edges_from_nids

def get_name_rowid_edges_from_nids(ibs, nids):
    aids_list = ibs.get_name_aids(nids)
    import itertools
    unflat_edges = (list(itertools.product(aids, aids)) for aids in aids_list)
    aid_pairs = [tup for tup in ut.iflatten(unflat_edges) if tup[0] != tup[1]]
    aids1 = ut.get_list_column(aid_pairs, 0)
    aids2 = ut.get_list_column(aid_pairs, 1)
    return aids1, aids2
开发者ID:Erotemic,项目名称:ibeis,代码行数:8,代码来源:viz_graph.py

示例4: get_name_rowid_edges_from_aids2

def get_name_rowid_edges_from_aids2(ibs, aids_list):
    # grouped version
    import itertools
    unflat_edges = (list(itertools.product(aids, aids)) for aids in aids_list)
    #if full:
    aid_pairs = [tup for tup in ut.iflatten(unflat_edges) if tup[0] != tup[1]]
    aids1 = ut.get_list_column(aid_pairs, 0)
    aids2 = ut.get_list_column(aid_pairs, 1)
    return aids1, aids2
开发者ID:heroinlin,项目名称:ibeis,代码行数:9,代码来源:viz_graph.py

示例5: draw_map_histogram

def draw_map_histogram(top_assignments, fnum=None, pnum=(1, 1, 1)):
    import plottool as pt
    bin_labels = ut.get_list_column(top_assignments, 0)
    bin_vals =  ut.get_list_column(top_assignments, 1)
    fnum = pt.ensure_fnum(fnum)
    # bin_labels = ['\n'.join(ut.textwrap.wrap(_lbl, width=30)) for _lbl in bin_labels]
    pt.draw_histogram(bin_labels, bin_vals, fnum=fnum, pnum=pnum,
                      transpose=True,
                      use_darkbackground=False,
                      #xtick_rotation=-10,
                      ylabel='Prob', xlabel='assignment')
    pt.set_title('Assignment probabilities')
开发者ID:heroinlin,项目名称:ibeis,代码行数:12,代码来源:pgm_viz.py

示例6: get_namescore_nonvoting_feature_flags

def get_namescore_nonvoting_feature_flags(fm_list, fs_list, dnid_list, name_groupxs, kpts1=None):
    r"""
    fm_list = [fm[:min(len(fm), 10)] for fm in fm_list]
    fs_list = [fs[:min(len(fs), 10)] for fs in fs_list]
    """
    fx1_list = [fm.T[0] for fm in fm_list]
    # Group annotation matches by name
    name_grouped_fx1_list = vt.apply_grouping_(fx1_list, name_groupxs)
    name_grouped_fs_list  = vt.apply_grouping_(fs_list,  name_groupxs)
    # Stack up all matches to a particular name, keep track of original indicies via offets
    name_invertable_flat_fx1_list = list(map(ut.invertible_flatten2_numpy, name_grouped_fx1_list))
    name_grouped_fx1_flat = ut.get_list_column(name_invertable_flat_fx1_list, 0)
    name_grouped_invertable_cumsum_list = ut.get_list_column(name_invertable_flat_fx1_list, 1)
    name_grouped_fs_flat = list(map(np.hstack, name_grouped_fs_list))
    if kpts1 is not None:
        xys1_ = vt.get_xys(kpts1).T
        kpts_xyid_list = vt.compute_unique_data_ids(xys1_)
        # Make nested group for every name by query feature index (accounting for duplicate orientation)
        name_grouped_xyid_flat = list(kpts_xyid_list.take(fx1) for fx1 in name_grouped_fx1_flat)
        xyid_groupxs_list = list(vt.group_indices(xyid_flat)[1] for xyid_flat in name_grouped_xyid_flat)
        name_group_fx1_groupxs_list = xyid_groupxs_list
    else:
        # Make nested group for every name by query feature index
        fx1_groupxs_list = [vt.group_indices(fx1_flat)[1] for fx1_flat in name_grouped_fx1_flat]
        name_group_fx1_groupxs_list = fx1_groupxs_list
    name_grouped_fid_grouped_fs_list = [
        vt.apply_grouping(fs_flat, fid_groupxs)
        for fs_flat, fid_groupxs in zip(name_grouped_fs_flat, name_group_fx1_groupxs_list)
    ]

    # Flag which features are valid in this grouped space. Only one keypoint should be able to vote
    # for each group
    name_grouped_fid_grouped_isvalid_list = [
        np.array([fs_group.max() == fs_group for fs_group in fid_grouped_fs_list])
        for fid_grouped_fs_list in name_grouped_fid_grouped_fs_list
    ]

    # Go back to being grouped only in name space
    #dtype = np.bool
    name_grouped_isvalid_flat_list = [
        vt.invert_apply_grouping2(fid_grouped_isvalid_list, fid_groupxs, dtype=np.bool)
        for fid_grouped_isvalid_list, fid_groupxs in zip(name_grouped_fid_grouped_isvalid_list, name_group_fx1_groupxs_list)
    ]

    name_grouped_isvalid_unflat_list = [
        ut.unflatten2(isvalid_flat, invertable_cumsum_list)
        for isvalid_flat, invertable_cumsum_list in zip(name_grouped_isvalid_flat_list, name_grouped_invertable_cumsum_list)
    ]

    # Reports which features were valid in name scoring for every annotation
    featflag_list = vt.invert_apply_grouping(name_grouped_isvalid_unflat_list, name_groupxs)
    return featflag_list
开发者ID:Erotemic,项目名称:ibeis,代码行数:52,代码来源:name_scoring.py

示例7: define_named_aid_cfgs

def define_named_aid_cfgs():
    """
    Definitions for common aid configurations
    TODO: potentially move to experiment configs
    """
    from ibeis.expt import annotation_configs

    named_defaults_dict = ut.dict_take(annotation_configs.__dict__, annotation_configs.TEST_NAMES)
    named_qcfg_defaults = dict(zip(annotation_configs.TEST_NAMES, ut.get_list_column(named_defaults_dict, "qcfg")))
    named_dcfg_defaults = dict(zip(annotation_configs.TEST_NAMES, ut.get_list_column(named_defaults_dict, "dcfg")))
    alias_keys = annotation_configs.alias_keys
    named_cfg_dict = {"qcfg": named_qcfg_defaults, "dcfg": named_dcfg_defaults}
    return named_cfg_dict, alias_keys
开发者ID:Erotemic,项目名称:ibeis,代码行数:13,代码来源:old_main_helpers.py

示例8: group_aids_by_featweight_species

def group_aids_by_featweight_species(ibs, aid_list, config2_=None):
    """ helper

    Example:
        >>> # ENABLE_DOCTEST
        >>> from ibeis.algo.preproc.preproc_probchip import *  # NOQA
        >>> import ibeis
        >>> ibs = ibeis.opendb('testdb1')
        >>> config2_ = None
        >>> aid_list = ibs.get_valid_aids()
        >>> grouped_aids, unique_species, groupxs = group_aids_by_featweight_species(ibs, aid_list, config2_)
    """
    if config2_ is None:
        featweight_species = ibs.cfg.featweight_cfg.featweight_species
    else:
        featweight_species = config2_.get('featweight_species')
        assert featweight_species is not None
    if featweight_species == 'uselabel':
        # Use the labeled species for the detector
        species_list = ibs.get_annot_species_texts(aid_list)
    else:
        species_list = [featweight_species]
    aid_list = np.array(aid_list)
    species_list = np.array(species_list)
    species_rowid = np.array(ibs.get_species_rowids_from_text(species_list))
    unique_species_rowids, groupxs = vtool.group_indices(species_rowid)
    grouped_aids    = vtool.apply_grouping(aid_list, groupxs)
    grouped_species = vtool.apply_grouping(species_list, groupxs)
    unique_species = ut.get_list_column(grouped_species, 0)
    return grouped_aids, unique_species, groupxs
开发者ID:heroinlin,项目名称:ibeis,代码行数:30,代码来源:preproc_probchip.py

示例9: testdb2_stuff

def testdb2_stuff():
    """
    tar -zcvf testdb2.tar.gz testdb2/
    """
    import ibeis
    ibs = ibeis.opendb('testdb2')

    #ibs.ensure_contributor_rowids()

    gid_list = ibs.get_valid_gids()

    # Group gids by species
    image_species_list = ut.get_list_column(
        ibs.unflat_map(ibs.get_annot_species_rowids, ibs.get_image_aids(gid_list)), 0)

    new_contrib_rowid1 = ibs.add_new_temp_contributor(offset=len(ibs.get_valid_contrib_rowids()))
    new_contrib_rowid2 = ibs.add_new_temp_contributor(offset=len(ibs.get_valid_contrib_rowids()))

    gids1, gids2 = list(ut.group_items(gid_list, image_species_list).values())

    party_rowids = ibs.add_party(['TestCar1', 'TestCar2'])
    partyid1, partyid2 = party_rowids
    ibs.set_image_contributor_rowid(gids1, [new_contrib_rowid1] * len(gids1))
    ibs.set_image_contributor_rowid(gids2, [new_contrib_rowid2] * len(gids2))
    ibs.set_image_party_rowids(gids1, [partyid1] * len(gids1))
    ibs.set_image_party_rowids(gids2, [partyid2] * len(gids2))
开发者ID:heroinlin,项目名称:ibeis,代码行数:26,代码来源:reset_testdbs.py

示例10: get_oracle_name_decision

def get_oracle_name_decision(metatup, ibs, qaid, choicetup, oracle_method=1):
    """
    Find what the correct decision should be ibs is the database we are working
    with ibs_gt has pristine groundtruth
    """
    if ut.VERBOSE:
        print('Oracle is making decision using oracle_method=%r' % oracle_method)
    if metatup is None:
        print('WARNING METATUP IS NONE')
        return None
    MAX_LOOK = 3  # the oracle should only see what the user sees
    (sorted_nids, sorted_nscore, sorted_rawscore, sorted_aids, sorted_ascores) = choicetup
    (ibs_gt, aid1_to_aid2) = metatup
    # Get the annotations that the user can see
    aid_list2 = ut.get_list_column(sorted_aids, 0)
    # Get the groundtruth name of the query
    aid2_to_aid1 = ut.invert_dict(aid1_to_aid2)
    qnid1 = ibs_gt.get_annot_name_rowids(aid2_to_aid1[qaid])
    # Make an oracle decision by choosing a name (like a user would)
    if oracle_method == 1:
        chosen_names = oracle_method1(ibs_gt, ibs, qnid1, aid_list2, aid2_to_aid1, sorted_nids, MAX_LOOK)
    elif oracle_method == 2:
        chosen_names = oracle_method2(ibs_gt, qnid1)
    else:
        raise AssertionError('unknown oracle method %r' % (oracle_method,))
    if ut.VERBOSE:
        print('Oracle decision is chosen_names=%r' % (chosen_names,))
    return chosen_names
开发者ID:Erotemic,项目名称:ibeis,代码行数:28,代码来源:automated_oracle.py

示例11: _get_annot_pair_info

def _get_annot_pair_info(ibs, aid1, aid2, qreq_, draw_fmatches, **kwargs):
    kpts1 = kwargs.get('kpts1', None)
    kpts2 = kwargs.get('kpts2', None)
    kpts2_list = None if kpts2 is None else [kpts2]
    rchip1, kpts1 = get_query_annot_pair_info(ibs, aid1, qreq_, draw_fmatches,
                                              kpts1=kpts1)
    annot2_data_list = get_data_annot_pair_info(ibs, [aid2], qreq_,
                                                draw_fmatches,
                                                kpts2_list=kpts2_list)
    rchip2, kpts2 = ut.get_list_column(annot2_data_list , 0)
    return rchip1, rchip2, kpts1, kpts2
开发者ID:Erotemic,项目名称:ibeis,代码行数:11,代码来源:viz_matches.py

示例12: get_aids_and_scores

 def get_aids_and_scores(qres, name_scoring=False, ibs=None):
     """ returns a chip index list and associated score list """
     if name_scoring:
         assert ibs is not None, 'must specify ibs for name_scoring'
         nscoretup = qres.get_nscoretup(ibs)
         (sorted_nids, sorted_nscore, sorted_aids, sorted_scores) = nscoretup
         score_arr = np.array(sorted_nscore)
         aid_arr = np.array(ut.get_list_column(sorted_aids, 0))
     else:
         aid_arr, score_arr = qres.get_aids_and_chip_scores()
     return aid_arr, score_arr
开发者ID:heroinlin,项目名称:ibeis,代码行数:11,代码来源:hots_query_result.py

示例13: test_training_data

def test_training_data(varydict, nDaids_basis):
    varydict['nDaids'] = nDaids_basis
    cfgdict_list = ut.all_dict_combinations(varydict)
    K_list = ut.get_list_column(cfgdict_list, 'K')
    nDaids_list = ut.get_list_column(cfgdict_list, 'nDaids')
    max_error = min(nDaids_basis)
    nError_perterb = np.random.rand(len(K_list))

    #def distance_point_polynomial(point, poly_coeff):
    #    """
    #    References:
    #        http://kitchingroup.cheme.cmu.edu/blog/2013/02/14/Find-the-minimum-distance-from-a-point-to-a-curve/
    #    """
    #    def f(x):
    #        return x ** 2
    #    def objective(X, *args):
    #        point = args[0]
    #        x, y = X
    #        px, py = point
    #        return np.sqrt((x - px) ** 2 + (y - py) ** 2)
    #    def c1(X, *args):
    #        x, y = X
    #        return f(x) - y
    #    X = sp.optimize.fmin_cobyla(objective, x0=[0.5, 0.5], args=(point,), cons=[c1], disp=False)
    #    return X
    #point_list = np.array([point for point in zip(nDaids_list, K_list)])
    #poly_coeff = [0.2,  0.5]  # K model_params
    #closest_point_list = np.array([distance_point_polynomial(point, poly_coeff) for point in point_list])
    #dist_list = np.sqrt(((point_list - closest_point_list) ** 2).sum(axis=1))
    #nError_list = max_error * dist_list / dist_list.max() + nError_perterb
    nError_list = (np.array(nDaids_list) * .00001)
    nError_list /= nError_list.max()
    nError_list *= (max_error - 2)
    nError_list += 1 + nError_perterb

    #K_list      = np.array([  1,   1,    1,   4,   4,    4,   7,   7,    7,   10,  10,   10,   13,  13,   13])
    #nDaids_list = np.array([100, 500, 1000, 100, 500, 1000, 100, 500, 1000,  100, 500, 1000,  100, 500, 1000])
    #nError_list = np.array([  5,  54,  130,  50,  50,   70,  14,  54,   40,   20,   9,   43,   90,  20,  130])
    return nDaids_list, K_list, nError_list
开发者ID:Erotemic,项目名称:ibeis,代码行数:39,代码来源:optimize_k.py

示例14: setup_pzmtest_subgraph

def setup_pzmtest_subgraph():
    import ibeis
    ibs = ibeis.opendb(db='PZ_MTEST')
    nids = ibs.get_valid_nids()
    aids_list = ibs.get_name_aids(nids)

    import itertools
    unflat_edges = (list(itertools.product(aids, aids)) for aids in aids_list)
    aid_pairs = [tup for tup in ut.iflatten(unflat_edges) if tup[0] != tup[1]]
    aids1 = ut.get_list_column(aid_pairs, 0)
    aids2 = ut.get_list_column(aid_pairs, 1)

    rng = np.random.RandomState(0)
    flags = rng.rand(len(aids1)) > .878
    aids1 = ut.compress(aids1, flags)
    aids2 = ut.compress(aids2, flags)

    for aid1, aid2 in zip(aids1, aids2):
        ibs.set_annot_pair_as_positive_match(aid1, aid2)
        ibs.set_annot_pair_as_positive_match(aid2, aid1)

    rowids = ibs._get_all_annotmatch_rowids()
    aids1 = ibs.get_annotmatch_aid1(rowids)
    aids2 = ibs.get_annotmatch_aid2(rowids)
开发者ID:heroinlin,项目名称:ibeis,代码行数:24,代码来源:annotmatch_funcs.py

示例15: compute_fgweights

def compute_fgweights(ibs, aid_list, config2_=None):
    """

    Example:
        >>> # SLOW_DOCTEST
        >>> from ibeis.algo.preproc.preproc_featweight import *  # NOQA
        >>> import ibeis
        >>> ibs = ibeis.opendb('testdb1')
        >>> aid_list = ibs.get_valid_aids()[1:2]
        >>> config2_ = None
        >>> featweight_list = compute_fgweights(ibs, aid_list)
        >>> result = np.array_str(featweight_list[0][0:3], precision=3)
        >>> print(result)
        [ 0.125  0.061  0.053]

    """
    nTasks = len(aid_list)
    print('[preproc_featweight.compute_fgweights] Preparing to compute %d fgweights' % (nTasks,))
    probchip_fpath_list = preproc_probchip.compute_and_write_probchip(ibs,
                                                                      aid_list,
                                                                      config2_=config2_)
    chipsize_list = ibs.get_annot_chip_sizes(aid_list, config2_=config2_)

    #if ut.DEBUG2:
    #    from PIL import Image
    #    probchip_size_list = [Image.open(fpath).size for fpath in probchip_fpath_list]  # NOQA
    #    #with ut.embed_on_exception_context:
    #    # does not need to happen anymore
    #    assert chipsize_list == probchip_size_list, 'probably need to clear chip or probchip cache'

    kpts_list = ibs.get_annot_kpts(aid_list, config2_=config2_)
    # Force grayscale reading of chips
    probchip_list = [vt.imread(fpath, grayscale=True) if exists(fpath) else None
                     for fpath in probchip_fpath_list]

    print('[preproc_featweight.compute_fgweights] Computing %d fgweights' % (nTasks,))
    arg_iter = zip(aid_list, kpts_list, probchip_list, chipsize_list)
    featweight_gen = ut.generate(gen_featweight_worker, arg_iter,
                                    nTasks=nTasks, ordered=True, freq=10)
    featweight_param_list = list(featweight_gen)
    #arg_iter = zip(aid_list, kpts_list, probchip_list)
    #featweight_param_list1 = [gen_featweight_worker((aid, kpts, probchip)) for
    #aid, kpts, probchip in arg_iter]
    #featweight_aids = ut.get_list_column(featweight_param_list, 0)
    featweight_list = ut.get_list_column(featweight_param_list, 1)
    print('[preproc_featweight.compute_fgweights] Done computing %d fgweights' % (nTasks,))
    return featweight_list
开发者ID:Erotemic,项目名称:ibeis,代码行数:47,代码来源:preproc_featweight.py


注:本文中的utool.get_list_column函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。