示例#1
0
def get_varied_pipecfg_lbls(cfgdict_list, pipecfg_list=None):
    if pipecfg_list is None:
        from ibeis.algo import Config
        cfg_default_dict = dict(Config.QueryConfig().parse_items())
        cfgx2_lbl = ut.get_varied_cfg_lbls(cfgdict_list, cfg_default_dict)
    else:
        # TODO: group cfgdict by config type and then get varied labels
        cfg_default_dict = None
        cfgx2_lbl = ut.get_varied_cfg_lbls(cfgdict_list, cfg_default_dict)
    return cfgx2_lbl
示例#2
0
 def hack_lnbnn_config_trail(qparams):
     query_cfg = Config.QueryConfig()
     lnbnn_trail = [
         query_cfg.nn_cfg.asdict(),
         query_cfg.nnweight_cfg.asdict(),
         query_cfg.sv_cfg.asdict(),
         query_cfg.agg_cfg.asdict(),
         query_cfg.flann_cfg.asdict(),
     ]
     # Does not include feautres. Instead use
     # print(ut.repr3([c.asdict() for c in ibs.depc.get_config_trail('featweight', {})]))
     return lnbnn_trail
示例#3
0
    def __init__(qparams, query_cfg=None, cfgdict=None):
        """
        Rename to pipeline params

        Structure to store static query pipeline parameters
        parses nested config structure into this flat one

        Args:
            query_cfg (QueryConfig): query_config
            cfgdict (dict or None): dictionary to update query_cfg with

        CommandLine:
            python -m ibeis.algo.hots.query_params --test-__init__

        Example:
            >>> # ENABLE_DOCTEST
            >>> from ibeis.algo.hots.query_params import *  # NOQA
            >>> import ibeis
            >>> ibs = ibeis.opendb('testdb1')
            >>> query_cfg = ibs.cfg.query_cfg
            >>> #query_cfg.pipeline_root = 'asmk'
            >>> cfgdict = {'pipeline_root': 'asmk', 'sv_on': False, 'fg_on': True}
            >>> qparams = QueryParams(query_cfg, cfgdict)
            >>> assert qparams.pipeline_root == 'smk'
            >>> assert qparams.fg_on is True
            >>> result = qparams.query_cfgstr
            >>> print(')_\n'.join(result.split(')_')))

        Example:
            >>> # ENABLE_DOCTEST
            >>> from ibeis.algo.hots.query_params import *  # NOQA
            >>> import ibeis
            >>> ibs = ibeis.opendb('testdb1')
            >>> query_cfg = ibs.cfg.query_cfg
            >>> #query_cfg.pipeline_root = 'asmk'
            >>> cfgdict = dict(rotation_invariance=True)
            >>> qparams = QueryParams(query_cfg, cfgdict)
            >>> ut.assert_eq(qparams.hesaff_params['rotation_invariance'], True)

            _smk_SMK(agg=True,t=0.0,a=3.0,idf)_
            VocabAssign(nAssign=10,a=1.2,s=None,eqw=T)_
            VocabTrain(nWords=8000,init=akmeans++,nIters=128,taids=all)_
            SV(OFF)_
            FEATWEIGHT(ON,uselabel,rf)_
            FEAT(hesaff+sift_)_
            CHIP(sz450)
        """
        # if given custom settings update the config and ensure feasibilty
        if query_cfg is None:
            query_cfg = Config.QueryConfig()
        if cfgdict is not None:
            query_cfg = query_cfg.deepcopy()
            query_cfg.update_query_cfg(**cfgdict)
        # Get flat item list
        param_list = Config.parse_config_items(query_cfg)
        # Assert that there are no config conflicts
        duplicate_keys = ut.find_duplicate_items(
            ut.get_list_column(param_list, 0))
        assert len(duplicate_keys
                   ) == 0, 'Configs have duplicate names: %r' % duplicate_keys
        # Set nexted config attributes as flat qparam properties
        for key, val in param_list:
            setattr(qparams, key, val)
        # Add params not implicitly represented in Config object
        pipeline_root = query_cfg.pipeline_root
        qparams.chip_cfg_dict = query_cfg._featweight_cfg._feat_cfg._chip_cfg.to_dict(
        )
        qparams.flann_params = query_cfg.flann_cfg.get_flann_params()
        qparams.hesaff_params = query_cfg._featweight_cfg._feat_cfg.get_hesaff_params(
        )
        qparams.pipeline_root = pipeline_root
        qparams.vsmany = pipeline_root == 'vsmany'
        qparams.vsone = pipeline_root == 'vsone'
        # Add custom strings to the mix as well
        # TODO; Find better way to specify config strings
        # FIXME: probchip is not in here
        qparams.probchip_cfgstr = query_cfg._featweight_cfg.get_cfgstr(
            use_feat=False, use_chip=False)
        qparams.featweight_cfgstr = query_cfg._featweight_cfg.get_cfgstr()
        qparams.chip_cfgstr = query_cfg._featweight_cfg._feat_cfg._chip_cfg.get_cfgstr(
        )
        qparams.feat_cfgstr = query_cfg._featweight_cfg._feat_cfg.get_cfgstr()
        qparams.nn_cfgstr = query_cfg.nn_cfg.get_cfgstr()
        qparams.nnweight_cfgstr = query_cfg.nnweight_cfg.get_cfgstr()
        qparams.sv_cfgstr = query_cfg.sv_cfg.get_cfgstr()
        qparams.flann_cfgstr = query_cfg.flann_cfg.get_cfgstr()
        qparams.query_cfgstr = query_cfg.get_cfgstr()
        qparams.vocabtrain_cfgstr = query_cfg.smk_cfg.vocabtrain_cfg.get_cfgstr(
        )
        qparams.rrvsone_cfgstr = query_cfg.rrvsone_cfg.get_cfgstr()