Ejemplo n.º 1
0
    def __init__(self, teacher, dataset_path, store_path, dataset_config,
                 best_trade_off):
        self.dataset_path = dataset_path
        self.store_path = store_path
        self.teacher = teacher
        self.dataset_config = dataset_config
        self.rotate = dataset_config.use_rotation
        self.trade_off = best_trade_off

        if os.path.exists(self.store_path):
            raise Exception("Store path already exists")
        else:
            os.makedirs(self.store_path)
            os.makedirs(os.path.join(self.store_path, "train"))
            os.makedirs(os.path.join(self.store_path, "valid"))
            os.makedirs(os.path.join(self.store_path, "test"))

        self.evaluate = util.create_simple_predictor(teacher['model'],
                                                     teacher['params'])
        self.creator = Creator(
            self.dataset_path,
            dim=(self.dataset_config.input_dim,
                 self.dataset_config.output_dim),
            preproccessing=self.dataset_config.use_preprocessing,
            std=self.dataset_config.dataset_std,
            reduce_training=self.dataset_config.reduce_training,
            reduce_testing=self.dataset_config.reduce_testing,
            reduce_validation=self.dataset_config.reduce_validation,
            only_mixed=self.dataset_config.only_mixed_labels,
            mix_ratio=self.dataset_config.mix_ratio)
        self.creator.load_dataset()
Ejemplo n.º 2
0
    def __init__(self, teacher, dataset_path, store_path, dataset_config, best_trade_off):
        self.dataset_path = dataset_path
        self.store_path = store_path
        self.teacher = teacher
        self.dataset_config = dataset_config
        self.rotate = dataset_config.use_rotation
        self.trade_off = best_trade_off

        if os.path.exists(self.store_path):
            raise Exception("Store path already exists")
        else:
            os.makedirs(self.store_path)
            os.makedirs(os.path.join(self.store_path, "train"))
            os.makedirs(os.path.join(self.store_path, "valid"))
            os.makedirs(os.path.join(self.store_path, "test"))

        self.evaluate = util.create_simple_predictor(teacher['model'], teacher['params'])
        self.creator = Creator(
            self.dataset_path,
            dim=(self.dataset_config.input_dim, self.dataset_config.output_dim),
            preproccessing=self.dataset_config.use_preprocessing,
            std=self.dataset_config.dataset_std,
            reduce_training=self.dataset_config.reduce_training,
            reduce_testing=self.dataset_config.reduce_testing,
            reduce_validation=self.dataset_config.reduce_validation,
            only_mixed=self.dataset_config.only_mixed_labels,
            mix_ratio=self.dataset_config.mix_ratio
        )
        self.creator.load_dataset()
Ejemplo n.º 3
0
verify, stage = get_command('-verify', default="0")
stage = "stage" + stage

is_tradeoff, tradeoff = get_command('-tradeoff', default="0.5")
tradeoff = float(tradeoff)

#Dataset path. Config used if not supplied
is_alt_dataset, alt_dataset = get_command('-dataset')
if is_alt_dataset:
    dataset_path = alt_dataset
#==============================================================

store = ParamStorage()
teacher = store.load_params(path=teacher_location)
evaluate = util.create_simple_predictor(teacher['model'], teacher['params'])

if not verify:
    creator = Creator(pr_path,
                      dim=(dataset_params.input_dim,
                           dataset_params.output_dim),
                      preproccessing=dataset_params.use_preprocessing,
                      std=dataset_params.dataset_std,
                      reduce_training=dataset_params.reduce_training,
                      reduce_testing=dataset_params.reduce_testing,
                      reduce_validation=dataset_params.reduce_validation)
    creator.load_dataset()

    data, labels = creator.sample_data(creator.train,
                                       samples,
                                       rotation=dataset_params.use_rotation)
Ejemplo n.º 4
0
stage = "stage" + stage

is_tradeoff, tradeoff = get_command('-tradeoff', default="0.5")
tradeoff = float(tradeoff)

#Dataset path. Config used if not supplied
is_alt_dataset, alt_dataset = get_command('-dataset')
if is_alt_dataset:
    dataset_path = alt_dataset
#==============================================================



store = ParamStorage()
teacher = store.load_params(path=teacher_location)
evaluate = util.create_simple_predictor(teacher['model'], teacher['params'])

if not verify:
    creator = Creator(
        pr_path,
        dim=(dataset_params.input_dim, dataset_params.output_dim),
        preproccessing=dataset_params.use_preprocessing,
        std=dataset_params.dataset_std,
        reduce_training=dataset_params.reduce_training,
        reduce_testing=dataset_params.reduce_testing,
        reduce_validation=dataset_params.reduce_validation
    )
    creator.load_dataset()

    data, labels = creator.sample_data(
        creator.train,