def _create_detection_exp(self, kind, classifier_conf, fold_id=None): diadem_id = self.exp_conf.exp_id exp_name = 'DIADEM_%i_Detection_%s' % (diadem_id, kind) if fold_id is not None: exp_name = '%s_fold_%i' % (exp_name, fold_id) secuml_conf = self.exp_conf.secuml_conf logger = secuml_conf.logger if kind == 'validation': dataset_conf = DatasetConf(self.exp_conf.dataset_conf.project, self.validation_conf.test_dataset, self.exp_conf.secuml_conf.logger) annotations_conf = AnnotationsConf('ground_truth.csv', None, logger) elif kind == 'test' and self.test_conf.method == 'dataset': dataset_conf = DatasetConf(self.exp_conf.dataset_conf.project, self.test_conf.test_dataset, self.exp_conf.secuml_conf.logger) annotations_conf = AnnotationsConf('ground_truth.csv', None, logger) else: dataset_conf = self.exp_conf.dataset_conf annotations_conf = self.exp_conf.annotations_conf features_conf = self.exp_conf.features_conf test_exp_conf = DetectionConf(secuml_conf, dataset_conf, features_conf, annotations_conf, self._get_alerts_conf(fold_id), name=exp_name, parent=diadem_id, fold_id=fold_id, kind=kind) return DetectionExp(test_exp_conf, session=self.session)
def _create_test_exp(self, fold_id=None): diadem_id = self.exp_conf.exp_id exp_name = 'DIADEM_%i_Test' % diadem_id if fold_id is not None: exp_name = '%s_fold_%i' % (exp_name, fold_id) secuml_conf = self.exp_conf.secuml_conf logger = secuml_conf.logger if self.test_conf.method == 'dataset': dataset_conf = DatasetConf(self.exp_conf.dataset_conf.project, self.test_conf.test_dataset, self.exp_conf.secuml_conf.logger) annotations_conf = AnnotationsConf('ground_truth.csv', None, logger) else: dataset_conf = self.exp_conf.dataset_conf annotations_conf = self.exp_conf.annotations_conf features_conf = self.exp_conf.features_conf test_exp_conf = TestConf(secuml_conf, dataset_conf, features_conf, annotations_conf, self.exp_conf.core_conf.classifier_conf, name=exp_name, parent=diadem_id, fold_id=fold_id, kind='test') return TestExp(test_exp_conf, alerts_conf=self._get_alerts_conf(fold_id), session=self.session)
def _create_detection_conf(self, kind, classifier_conf, fold_id=None): diadem_id = self.exp_conf.exp_id exp_name = 'DIADEM_%i_Detection_%s' % (diadem_id, kind) if fold_id is not None: exp_name = '%s_fold_%i' % (exp_name, fold_id) secuml_conf = self.exp_conf.secuml_conf logger = secuml_conf.logger if (kind == 'validation' or (kind == 'test' and self.test_conf.method == 'datasets')): validation_conf = getattr(self, '%s_conf' % kind) annotations_conf = AnnotationsConf('ground_truth.csv', None, logger) features_conf = self.exp_conf.features_conf if validation_conf.streaming: stream_batch = validation_conf.stream_batch features_conf = features_conf.copy_streaming(stream_batch) dataset_confs = [ DatasetConf(self.exp_conf.dataset_conf.project, test_dataset, self.exp_conf.secuml_conf.logger) for test_dataset in validation_conf.validation_datasets ] else: dataset_confs = [self.exp_conf.dataset_conf] annotations_conf = self.exp_conf.annotations_conf features_conf = self.exp_conf.features_conf alerts_conf = None if fold_id is None and kind != 'train': alerts_conf = self.exp_conf.alerts_conf return [ DetectionConf(secuml_conf, dataset_conf, features_conf, annotations_conf, alerts_conf, name=exp_name, parent=diadem_id, fold_id=fold_id, kind=kind) for dataset_conf in dataset_confs ]