예제 #1
0
    def __init__(self, experiment_directory=None, config=None):
        super(Maiden, self).__init__(experiment_directory)
        # Privates
        self._device = None
        self._meta_config['exclude_attrs_from_save'] = [
            'data_loader', '_device'
        ]
        if config is not None:  # TODO
            self.read_config_file(config)

        self.DEFAULT_DISPATCH = 'train'
        self.auto_setup()

        # register additional callbacks
        self.register_run_info_callback()
        self.register_reduce_dataset_callback()
        self.trainer.register_callback(
            SaveModelAtBestValidationScore(
                to_directory=self.checkpoint_directory,
                smoothness=0,
                verbose=True))
        if self.get('trainer/criterion/losses/fgbg') is not None:
            self.build_fgbg_metric()
        # register anywhere logger for scalars
        register_logger(self, 'scalars')
예제 #2
0
    def __init__(self, experiment_directory=None, config=None):
        super(VaeCremiExperiment, self).__init__(experiment_directory)
        # Privates
        self._device = None
        self._meta_config['exclude_attrs_from_save'] = [
            'data_loader', '_device'
        ]
        if config is not None:
            self.read_config_file(config)

        self.DEFAULT_DISPATCH = 'train'
        self.auto_setup()

        register_logger(self, 'scalars')
        # register_logger(self, 'embedding')
        # register_logger(self, 'image')

        offsets = self.get_default_offsets()
        self.set('global/offsets', offsets)
        self.set(
            'loaders/general/volume_config/segmentation/affinity_config/offsets',
            offsets)

        self.model_class = list(self.get('model').keys())[0]

        self.set_devices()
예제 #3
0
    def __init__(self, experiment_directory=None, config=None):
        super(BaseCremiExperiment, self).__init__(experiment_directory)
        # Privates
        self._device = None
        self._meta_config['exclude_attrs_from_save'] = [
            'data_loader', '_device'
        ]
        if config is not None:
            self.read_config_file(config)

        self.DEFAULT_DISPATCH = 'train'
        self.auto_setup()

        register_logger(self, 'scalars')
    def __init__(self, experiment_directory=None, config=None):
        super(BaseCremiExperiment, self).__init__(experiment_directory)
        # Privates
        self._device = None
        self._meta_config['exclude_attrs_from_save'] = [
            'data_loader', '_device'
        ]
        if config is not None:
            self.read_config_file(config)

        self.DEFAULT_DISPATCH = 'train'
        self.auto_setup()

        # register_logger(FirelightLogger, "image")
        register_logger(self, 'scalars')

        # offsets = self.get_boundary_offsets()
        # self.set('global/offsets', offsets)
        # self.set('loaders/general/volume_config/segmentation/affinity_config/offsets', offsets)

        if "model_class" in self.get('model'):
            self.model_class = self.get('model/model_class')
        else:
            self.model_class = list(self.get('model').keys())[0]

        if self.get("loaders/general/master_config/downscale_and_crop"
                    ) is not None:
            master_conf = self.get("loaders/general/master_config")

            ds_config = self.get(
                "loaders/general/master_config/downscale_and_crop")
            nb_tensors = len(ds_config)
            nb_inputs = self.get("model/model_kwargs/number_multiscale_inputs")
            nb_targets = nb_tensors - nb_inputs
            if "affinity_config" in master_conf:
                affs_config = deepcopy(master_conf.get("affinity_config", {}))
                if affs_config.get("use_dynamic_offsets", False):
                    raise NotImplementedError
                    nb_targets = 1
                else:
                    affs_config.pop("global", None)
                    nb_targets = len(affs_config)
            self.set("trainer/num_targets", nb_targets)
        else:
            self.set("trainer/num_targets", 1)

        self.set_devices()