def _make_deploy_metadata(self, task_key=None): pblm = self.pblm if pblm.samples is None: pblm.setup() if task_key is None: task_key = pblm.primary_task_key # task_keys = list(pblm.samples.supported_tasks()) clf_key = pblm.default_clf_key data_key = pblm.default_data_key # Save the classifie data_info = pblm.feat_extract_info[data_key] feat_extract_config, feat_dims = data_info samples = pblm.samples labels = samples.subtasks[task_key] edge_hashid = samples.edge_set_hashid() label_hashid = samples.task_label_hashid(task_key) tasksamp_hashid = samples.task_sample_hashid(task_key) annot_hashid = ut.hashid_arr(samples._unique_annots.visual_uuids, 'annots') # species = pblm.infr.ibs.get_primary_database_species( # samples._unique_annots.aid) species = '+'.join(sorted(set(samples._unique_annots.species))) metadata = { 'tasksamp_hashid': tasksamp_hashid, 'edge_hashid': edge_hashid, 'label_hashid': label_hashid, 'annot_hashid': annot_hashid, 'class_hist': labels.make_histogram(), 'class_names': labels.class_names, 'data_info': data_info, 'task_key': task_key, 'species': species, 'data_key': data_key, 'clf_key': clf_key, 'n_dims': len(feat_dims), # 'aid_pairs': samples.aid_pairs, } meta_cfgstr = ut.repr2(metadata, kvsep=':', itemsep='', si=True) hashid = ut.hash_data(meta_cfgstr)[0:16] deploy_fname = self.fname_fmtstr.format(hashid=hashid, ** metadata) + '.cPkl' deploy_metadata = metadata.copy() deploy_metadata['hashid'] = hashid deploy_metadata['fname'] = deploy_fname return deploy_metadata, deploy_fname
def _make_cfgstr(extr, edges): ibs = extr.ibs edge_uuids = ibs.unflat_map(ibs.get_annot_visual_uuids, edges) edge_hashid = ut.hashid_arr(edge_uuids, 'edges') _cfg_lbl = ut.partial(ut.repr2, si=True, itemsep='', kvsep=':') match_configclass = ibs.depc_annot.configclass_dict['pairwise_match'] cfgstr = '_'.join([ edge_hashid, _cfg_lbl(extr.match_config), _cfg_lbl(extr.pairfeat_cfg), 'global(' + _cfg_lbl(extr.global_keys) + ')', 'pairwise_match_version=%r' % (match_configclass().version,) ]) return cfgstr