def get_param_info_list(nnweight_cfg): # new way to try and specify config options. # not sure if i like it yet param_info_list = ut.flatten([ [ ut.ParamInfo('ratio_thresh', None, type_=float, hideif=None), ut.ParamInfoBool('lnbnn_on', True, hideif=False), ut.ParamInfoBool('const_on', False, hideif=False), ut.ParamInfoBool('borda_on', False, hideif=False), ut.ParamInfoBool('lograt_on', False, hideif=False), #ut.ParamInfoBool('loglnbnn_on', False, hideif=False), #ut.ParamInfoBool('logdist_on', False, hideif=False), #ut.ParamInfoBool('dist_on', False, hideif=False), ut.ParamInfoBool('normonly_on', False, hideif=False), ut.ParamInfoBool('bar_l2_on', False, hideif=False), ut.ParamInfoBool('cos_on', False, hideif=False), ut.ParamInfoBool('fg_on', True, hideif=False), ut.ParamInfo('normalizer_rule', 'last', '', valid_values=['last', 'name']), ut.ParamInfo('lnbnn_normer', None, hideif=None, help_='config string for lnbnn score normalizer'), ut.ParamInfo('lnbnn_norm_thresh', .5, type_=float, hideif=lambda cfg: not cfg['lnbnn_normer'] , help_='config string for lnbnn score normalizer'), # ut.ParamInfoBool('can_match_sameimg', False, 'sameimg', hideif=False), ut.ParamInfoBool('can_match_samename', True, 'samename', hideif=True), # Hacked in #ut.ParamInfoBool('root_sift_on', False, hideif=False), ut.ParamInfoBool('sqrd_dist_on', False, hideif=True), #ut.ParamInfoBool('sqrd_dist_on', True, hideif=True), ], ]) return param_info_list
class VsoneConfig(object): _param_info_list = [ ut.ParamInfo('distinctiveness_model'), ut.ParamInfo('score_norm_model'), ] pass
class ThumbnailConfig(dtool.Config): _param_info_list = [ ut.ParamInfo('draw_annots', True, hideif=True), ut.ParamInfo('thumbsize', None, hideif=None), ut.ParamInfo('ext', '.png', hideif='.png'), ut.ParamInfo('force_serial', False, hideif=False), ]
def get_param_info_list(self): return [ ut.ParamInfo('manual_extract', False, hideif=False), #ut.ParamInfo('ntversion', 1) ut.ParamInfo('version', 4), ut.ParamInfo('kp_net', '128_decoupled'), ]
def get_param_info_list(self): return [ ut.ParamInfo('K', 4), ut.ParamInfo('Knorm', 1), ut.ParamInfo('checks', 800), ut.ParamInfo('version', 1), ]
def get_param_info_list(self): return [ ut.ParamInfo('csize_max', 8), ut.ParamInfo('csize_min', 2), ut.ParamInfo('csize_step', 2), #ut.ParamInfo('sizes', [2, 4, 6, 8]), # these are percentage (as ints) of trailing edge width ut.ParamInfo('version', 2), ]
class VocabConfig(dtool.Config): _param_info_list = [ ut.ParamInfo('algorithm', 'minibatch', 'alg'), ut.ParamInfo('random_seed', 42, 'seed'), ut.ParamInfo('num_words', 1000, 'n'), ut.ParamInfo('version', 2), ut.ParamInfo('n_init', 1), ]
class FeatConfig(dtool.Config): _param_info_list = [ ut.ParamInfo('affine_invariance', True), ut.ParamInfo('rotation_invariance', False), ut.ParamInfo('augment_orientation', False), ut.ParamInfo('dense', False), ut.ParamInfo('dense_stride', False, hideif=lambda cfg: not cfg['dense']), ]
def get_param_info_list(self): return [ ut.ParamInfo('crop_dim_size', 750, 'sz', hideif=750), ut.ParamInfo('crop_enabled', True, hideif=False), #ut.ParamInfo('ccversion', 1) ut.ParamInfo('version', 2), ut.ParamInfo('ext', '.png'), ]
def get_param_info_list(occur_cfg): param_info_list = [ ut.ParamInfo('min_imgs_per_occurrence', 1, 'minper='), ut.ParamInfo('cluster_algo', 'agglomerative', '', valid_values=['agglomerative', 'meanshift']), ut.ParamInfo('quantile', .01, 'quant', hideif=lambda cfg: cfg['cluster_algo'] != 'meanshift'), ut.ParamInfo('seconds_thresh', 600, 'sec', hideif=lambda cfg: cfg['cluster_algo'] != 'agglomerative'), ut.ParamInfo('use_gps', False, hideif=False), ] return param_info_list
class InferenceConfig(dtool.Config): _param_info_list = [ ut.ParamInfo('min_labels', 1), ut.ParamInfo('max_labels', 5), ut.ParamInfo('thresh_method', 'elbow', valid_values=['elbow', 'mean', 'median', 'custom']), ut.ParamInfo('thresh', .5, hideif=lambda cfg: cfg['thresh_method'] != 'custom'), ]
def get_param_info_list(self): return [ #ut.ParamInfo('score_method', 'csum'), # should this be the only thing here? #ut.ParamInfo('daids', None), ut.ParamInfo('decision', 'max'), #ut.ParamInfo('sizes', (5, 10, 15, 20)), ut.ParamInfo('weight_import', 1), ut.ParamInfo('window', 10), #ut.ParamInfo('bcdtwversion', 1), ut.ParamInfo('version', 8), ]
class InvertedIndexConfig(dtool_ibeis.Config): _param_info_list = [ ut.ParamInfo('nAssign', 1), #ut.ParamInfo('int_rvec', False, hideif=False), ut.ParamInfo('int_rvec', True, hideif=False), ut.ParamInfo('massign_equal,', False), ut.ParamInfo('massign_alpha,', 1.2), # ut.ParamInfo('massign_sigma,', 80.0, hideif=lambda cfg: cfg['massign_equal']), ut.ParamInfo('inva_version', 2), # #massign_sigma=80.0, #massign_equal_weights=False ]
class ClassifierConfig(dtool.Config): _param_info_list = [ ut.ParamInfo('classifier_sensitivity', None), ] _sub_config_list = [ ThumbnailConfig ]
def rectify_item(key, val): if val is None: return ut.ParamInfo(key, val) elif isinstance(val, ut.ParamInfo): if val.varname is None: # Copy and assign a new varname pi = copy.deepcopy(val) pi.varname = key else: pi = val assert pi.varname == key, ( 'Given varname=%r does not match key=%r' % (pi.varname, key)) return pi else: return ut.ParamInfo(key, val, type_=type(val))
class PairFeatureConfig(dt.Config): """ Config for building pairwise feature dimensions I.E. Config to distil unordered feature correspondences into a fixed length vector. """ _param_info_list = [ # ut.ParamInfo('indices', slice(0, 5)), ut.ParamInfo('indices', []), ut.ParamInfo('summary_ops', { # 'invsum', 'sum', 'std', 'mean', 'len', 'med'}), ut.ParamInfo('local_keys', None), ut.ParamInfo('sorters', [ # 'ratio', 'norm_dist', 'match_dist' # 'lnbnn', 'lnbnn_norm_dist', ]), # ut.ParamInfo('bin_key', None, valid_values=[None, 'ratio']), ut.ParamInfo('bin_key', 'ratio', valid_values=[None, 'ratio']), # ut.ParamInfo('bins', [.5, .6, .7, .8]) # ut.ParamInfo('bins', None, type_=eval), ut.ParamInfo('bins', (.625,), type_=eval), # ut.ParamInfo('need_lnbnn', False), ut.ParamInfo('use_na', False), # change to True if sklearn has RFs with nan support ]
class VocabConfig(dtool.Config): """ Example: >>> from ibeis.core_annots import * # NOQA >>> cfg = VocabConfig() >>> result = str(cfg) >>> print(result) """ _param_info_list = [ ut.ParamInfo('algorithm', 'kdtree', 'alg'), ut.ParamInfo('random_seed', 42, 'seed'), ut.ParamInfo('num_words', 1000, 'seed'), ut.ParamInfo('version', 1), # max iters # flann params # random seed ] _sub_config_list = []
class DummyVsManyConfig(dtool.Config): # Different pipeline components can go here as well as dependencies # that were not explicitly enumerated in the tree structure _param_info_list = [ #ut.ParamInfo('score_method', 'csum'), # should this be the only thing here? #ut.ParamInfo('daids', None), ut.ParamInfo('distinctiveness_model', None), ut.ParamInfo('version', 2), ] _sub_config_list = [ # I guess different annots might want different configs ... DummyChipConfig, DummyKptsConfig, DummyIndexerConfig, DummyNNConfig, DummySVERConfig ]
def rectify_item(key, val): if val is None: return ut.ParamInfo(key, val) elif isinstance(val, ut.ParamInfo): if val.varname is None: # Copy and assign a new varname pi = copy.deepcopy(val) pi.varname = key else: pi = val assert pi.varname == key, ( 'Given varname=%r does not match key=%r' % (pi.varname, key)) return pi else: if isinstance(val, Config): # Set table name from key when doing nested from dicts if val.__class__.__name__ == 'UnnamedConfig': val.__class__.__name__ = key + 'Config' return ut.ParamInfo(key, val, type_=type(val))
def gridsearch_addWeighted(): r""" CommandLine: python -m vtool.blend --test-gridsearch_addWeighted --show Example: >>> # GRIDSEARCH >>> from vtool.blend import * # NOQA >>> gridsearch_addWeighted() >>> ut.show_if_requested() """ import cv2 import vtool as vt def test_func(src1, src2, alpha=1.0, **kwargs): beta = 1.0 - alpha src1 = vt.rectify_to_float01(src1) src2 = vt.rectify_to_float01(src2) dst = np.empty(src1.shape, dtype=src1.dtype) cv2.addWeighted(src1=src1, src2=src2, dst=dst, alpha=alpha, beta=beta, dtype=-1, **kwargs) return dst img1, img2 = testdata_blend() args = img1, img2 = vt.make_channels_comparable(img1, img2) param_info = ut.ParamInfoList( 'blend_params', [ ut.ParamInfo('alpha', .8, varyvals=np.linspace(0, 1.0, 5).tolist()), #ut.ParamInfo('beta', .8, ut.ParamInfo('gamma', .0, varyvals=np.linspace(0, 1.0, 5).tolist()), #varyvals=[.0],)) #ut.ParamInfo('gamma', .8, 'alpha=', # varyvals=np.linspace(0, 1.0, 9).tolist()), ]) gridsearch_image_function(param_info, test_func, args)
def get_param_info_list(self): return [ ut.ParamInfo('n_neighbors', 3, 'n_nb'), ut.ParamInfo('ignore_notch', True, 'ign_n', hideif=False), #ut.ParamInfo('teversion', 1), ut.ParamInfo('version', 9), ut.ParamInfo('use_te_scorer', True, 'te_s', hideif=False), ut.ParamInfo('te_score_weight', 0.5, 'w_tes'), ut.ParamInfo('te_net', 'annot_res'), ut.ParamInfo('te_score_method', 'avg', 'te_sm'), ut.ParamInfo( 'tol', None ), # allow the trailing edge to go x percentage of the image height below ]
class ProbchipConfig(dtool.Config): """ CommandLine: python -m dtool.example_depcache --exec-ProbchipConfig --show Example: >>> # DISABLE_DOCTEST >>> from wbia.dtool.depcache_control import * # NOQA >>> from wbia.dtool.example_depcache import testdata_depc >>> depc = testdata_depc() >>> table = depc['probchip'] >>> exec(ut.execstr_funckw(table.get_rowid), globals()) >>> config = table.configclass(testerror=True) >>> root_rowids = [1, 2, 3] >>> parent_rowids = list(zip(root_rowids)) >>> proptup_gen = list(table.preproc_func(depc, root_rowids, config)) >>> pc_rowids = depc.get_rowids('probchip', root_rowids, config) >>> prop_list2 = depc.get('probchip', root_rowids, config=config, read_extern=False) >>> print(prop_list2) >>> #depc.new_request('probchip', [1, 2, 3]) >>> fg_rowids = depc.get_rowids('fgweight', root_rowids, config) >>> fg = depc.get('fgweight', root_rowids, config=config) >>> ############# >>> config = table.configclass(testerror=False) >>> root_rowids = [1, 2, 3] >>> parent_rowids = list(zip(root_rowids)) >>> proptup_gen = list(table.preproc_func(depc, root_rowids, config)) >>> pc_rowids2 = depc.get_rowids('probchip', root_rowids, config) >>> prop_list2 = depc.get('probchip', root_rowids, config=config, read_extern=False) >>> print(prop_list2) >>> #depc.new_request('probchip', [1, 2, 3]) >>> fg_rowids2 = depc.get_rowids('fgweight', root_rowids, config) """ _param_info_list = [ ut.ParamInfo('testerror', False, hideif=False), ut.ParamInfo('ext', '.png', hideif='.png'), ]
class NormFeatScoreConfig(dtool.Config): _alias = 'nfscfg' _param_info_list = [ ut.ParamInfo('disttype', None), ut.ParamInfo('namemode', True), ut.ParamInfo('fsvx', None, type_='fuzzy_subset', hideif=None), ut.ParamInfo('threshx', None, hideif=None), ut.ParamInfo('thresh', .9, hideif=lambda cfg: cfg['threshx'] is None), ut.ParamInfo('num', 5), # ut.ParamInfo('top_percent', None, hideif=None), ut.ParamInfo('top_percent', .5, hideif=None), ]
class LocalizerConfig(dtool.Config): _param_info_list = [ ut.ParamInfo('algo', 'yolo'), ut.ParamInfo('sensitivity', 0.0), ut.ParamInfo('species', 'zebra_plains', hideif='zebra_plains'), ut.ParamInfo('config_filepath', None), ut.ParamInfo('weight_filepath', None), ut.ParamInfo('grid', False), ] _sub_config_list = [ ThumbnailConfig ]
class DetectorConfig(dtool.Config): _param_info_list = [ ut.ParamInfo('classifier_sensitivity', 0.82), ut.ParamInfo('localizer_config_filepath', None), ut.ParamInfo('localizer_weight_filepath', None), ut.ParamInfo('localizer_grid', False), ut.ParamInfo('localizer_sensitivity', 0.16), ut.ParamInfo('labeler_sensitivity', 0.42), ] _sub_config_list = [ ThumbnailConfig, LocalizerConfig, ]
def get_param_info_list(rrvsone_cfg): # new way to try and specify config options. # not sure if i like it yet param_info_list = ut.flatten([ [ ut.ParamInfo('index_method', 'single', ''), ut.ParamInfo('K', 4, type_=int), ut.ParamInfo('Knorm', 1, 'Kn='), ut.ParamInfo('use_k_padding', False, 'padk='), ut.ParamInfo('single_name_condition', False, 'nameknn', type_=bool, hideif=False), ut.ParamInfo('checks', 800, 'cks', type_=int), #ut.ParamInfo('ratio_thresh', None, type_=float, hideif=None), ], ]) return param_info_list
def get_param_info_list(rrvsone_cfg): from ibeis.algo.hots import distinctiveness_normalizer from ibeis.algo.hots import vsone_pipeline # new way to try and specify config options. # not sure if i like it yet param_info_list = ut.flatten([ [ ut.ParamInfo('rrvsone_on', False, ''), ], vsone_pipeline.OTHER_RRVSONE_PARAMS.aslist(), vsone_pipeline.SHORTLIST_DEFAULTS.aslist(), vsone_pipeline.COEFF_DEFAULTS.aslist(), vsone_pipeline.UNC_DEFAULTS.aslist(), vsone_pipeline.SCR_DEFAULTS.aslist(), vsone_pipeline.COVKPTS_DEFAULT.aslist( hideif=lambda cfg: not cfg['covscore_on'] or cfg['maskscore_mode'] != 'kpts'), vsone_pipeline.COVGRID_DEFAULT.aslist( hideif=lambda cfg: not cfg['covscore_on'] or cfg['maskscore_mode'] != 'grid'), distinctiveness_normalizer.DCVS_DEFAULT.aslist( hideif=lambda cfg: not cfg['dcvs_on']), ]) return param_info_list
class SMKRequestConfig(dtool_ibeis.Config): """ Figure out how to do this """ _param_info_list = [ ut.ParamInfo('proot', 'smk'), ut.ParamInfo('smk_alpha', 3.0), ut.ParamInfo('smk_thresh', 0.0), #ut.ParamInfo('smk_thresh', -1.0), ut.ParamInfo('agg', True), ut.ParamInfo('data_ma', False), # hack for query only multiple assignment ut.ParamInfo( 'word_weight_method', 'idf', shortprefix='wwm'), # hack for query only multiple assignment ut.ParamInfo('smk_version', 3), ] _sub_config_list = [ core_annots.ChipConfig, core_annots.FeatConfig, old_config.SpatialVerifyConfig, vocab_indexer.VocabConfig, inverted_index.InvertedIndexConfig, MatchHeuristicsConfig, ]
class DummyChipConfig(dtool.Config): """ Example: >>> # ENABLE_DOCTEST >>> from dtool.example_depcache import * # NOQA >>> cfg = DummyChipConfig() >>> cfg.dim_size = 700 >>> cfg.histeq = True >>> print(cfg) >>> cfg.histeq = False >>> print(cfg) """ _param_info_list = [ ut.ParamInfo('resize_dim', 'width', valid_values=['area', 'width', 'heigh', 'diag']), ut.ParamInfo('dim_size', 500, 'sz'), ut.ParamInfo('preserve_aspect', True), ut.ParamInfo('histeq', False, hideif=False), ut.ParamInfo('ext', '.png'), ut.ParamInfo('version', 0), ]
class MatchHeuristicsConfig(dtool.Config): _param_info_list = [ ut.ParamInfo('can_match_self', False), ut.ParamInfo('can_match_samename', True), ut.ParamInfo('can_match_sameimg', False), ]