Пример #1
0
    def load_SS_predict(self):
        # set_dict = data_dict().non_empty_with_depth()

        # train_x = set_dict['train_x']
        # train_y = set_dict['train_y']
        # valid_x = set_dict['valid_x']
        # valid_y = set_dict['valid_y']

        train_predict = load_pickle('./train_predict')
        valid_predict = load_pickle('./valid_predict')

        # SS_pipe = SS_baseline().load_baseline()
        # ss = SS_pipe.model
        # train_predict = ss.predict(train_x)
        # train_predict = mask_label_encoder.from_label(train_predict)
        # valid_predict = ss.predict(valid_x)
        # valid_predict = mask_label_encoder.from_label(valid_predict)
        # dump_pickle(train_predict, './train_predict')
        # dump_pickle(valid_predict, './valid_predict')
        # return

        # print(train_predict[0])
        # print(train_y[0])

        return train_predict, valid_predict
Пример #2
0
 def load(self, path):
     load_obj = load_pickle(path)
     if load_obj.__class__ is not self.__class__:
         raise TypeError(
             f"load obj is not {load_obj.__class__} is not match with expected class {self.__class__}"
         )
     new_obj = self.__class__()
     for key, items in load_obj.__dict__.items():
         setattr(new_obj, key, items)
     return new_obj
Пример #3
0
    def load(self, path):
        pkl_path = path_join(path, 'test.pkl')
        if not os.path.exists(pkl_path) or not self.caching:
            make_data_pkl()

        pkl = load_pickle(pkl_path)

        self.add_data('image', pkl['image'])
        self.add_data('id', pkl['id'])
        self.add_data('depth', pkl['depths'])
        self.add_data('depth_image', pkl['depth_image'])
        # self.x_keys = ['image', 'depth']
        self.x_keys = ['image']
Пример #4
0
    def from_pickle(self, path, overwrite_self=False, **kwargs):
        load_obj = load_pickle(path)

        # for auto detect pickle type
        if load_obj.__class__ is not self.__class__:
            raise TypeError(
                f"load obj is not {load_obj.__class__} is not match with expected class {self.__class__}"
            )
        new_obj = self.__class__()
        for key, items in load_obj.__dict__.items():
            setattr(new_obj, key, items)

        if overwrite_self:
            for key, val in new_obj.__dict__.items():
                self.__dict__[key] = val

        return new_obj
Пример #5
0
    def load(self, path):
        pkl_path = path_join(path, 'train.pkl')
        if not os.path.exists(pkl_path) or not self.caching:
            make_data_pkl()

        pkl = load_pickle(pkl_path)

        self.add_data('image', pkl['image'])
        self.add_data('id', pkl['id'])
        self.add_data('mask', pkl['mask'])
        self.add_data('depth', pkl['depths'])
        self.add_data('mask_rate', pkl['mask_rate'])
        self.add_data('empty_mask', pkl['empty_mask'])
        self.add_data('is_weired_mask', pkl['is_weired_mask'])
        self.add_data('depth_image', pkl['depth_image'])

        # self.x_keys = ['image', 'depth']
        self.x_keys = ['image']
        self.y_keys = ['mask']
Пример #6
0
 def _load_params(self, path):
     self._apply_params(load_pickle(path))
Пример #7
0
    def load_params(self, path):
        self.log.info('load params from {}'.format(path))
        params = load_pickle(path)

        self.import_params(params)
Пример #8
0
 def from_pickle(path):
     return load_pickle(path)