コード例 #1
0
ファイル: train.py プロジェクト: wpilibsuite/supervisely
    def _make_tf_train_config(self):
        self.train_iters = self.tf_data_dicts['train'][
            'sample_cnt'] // self.config['batch_size']['train']
        total_steps = self.config['epochs'] * self.train_iters
        src_size = self.config['input_size']
        input_size = (src_size['height'], src_size['width'])
        base_config_path, remake_config_fn = determine_tf_config(
            self.model_configuration)

        tf_config = load_sample_config(base_config_path)

        weights_dir = osp.join(sly.TaskPaths.MODEL_DIR, "model_weights")
        if (not sly.fs.dir_exists(weights_dir)
            ) or sly.fs.dir_empty(weights_dir):
            checkpoint = None
            logger.info('Weights will not be inited.')
        else:
            checkpoint = osp.join(sly.TaskPaths.MODEL_DIR, 'model_weights',
                                  'model.ckpt')
            logger.info('Weights will be loaded from previous train.')

        self.tf_config = remake_config_fn(
            tf_config, 'SUPERVISELY_FORMAT', total_steps,
            max(self.class_title_to_idx.values()), input_size,
            self.config['batch_size']['train'], self.config['lr'], checkpoint)

        logger.info(self.tf_config)
        logger.info('Model config created.')
コード例 #2
0
ファイル: train.py プロジェクト: yunweidashuju/supervisely
    def _make_tf_train_config(self):
        self.train_iters = self.tf_data_dicts['train'][
            'sample_cnt'] // self.config['batch_size']['train']
        total_steps = self.config['epochs'] * self.train_iters
        src_size = self.config['input_size']
        input_size_wh = (src_size['width'], src_size['height'])

        tf_config = load_sample_config(self.base_mask_config_path)

        if self.helper.model_dir_is_empty():
            checkpoint = None
            logger.info('Weights will not be inited.')
        else:
            checkpoint = osp.join(self.helper.paths.model_dir, 'model_weights',
                                  'model.ckpt')
            logger.info('Weights will be loaded from previous train.')

        self.tf_config = remake_mask_rcnn_config(
            tf_config, 'SUPERVISELY_FORMAT', total_steps,
            len(self.out_classes), input_size_wh,
            self.config['batch_size']['train'], self.config['lr'], checkpoint)
        logger.info('Model config created.')