Esempio n. 1
0
    def train(self):
        """Compiles and trains the model"""
        LOG.info('\n Training started.')
        self._set_training_parameters()

        train_parameters = {
            'device': self.device,
            'model': self.model,
            'dataloaders': (self.trainloader, self.valloader),
            'epochs': self.epochs,
            'optimizer': self.optimizer,
            'criterion': self.criterion,
            'metrics': self.metric,
            'save_ckpt_interval': self.save_ckpt_interval,
            'ckpt_dir': self.paths.ckpt_dir,
            'summary_dir': self.paths.summary_dir,
        }

        trainer = Trainer(**train_parameters)
        trainer.train()
    def train(self):
        """Compiles and trains the model"""
        LOG.info('\n Training started.')
        self._set_training_parameters()
        
        train_parameters = {
            'device': self.device,
            'model': self.model,
            'dataloaders': (self.trainloader, self.valloader),
            'epochs': self.epochs,
            'optimizer': self.optimizer,
            'criterion': self.criterion,
            'metrics': self.metric,
            'save_ckpt_interval': self.save_ckpt_interval,
            'ckpt_dir': self.paths.ckpt_dir,
            'summary_dir': self.paths.summary_dir,
            'img_size': self.config.data.img_size,
            'vis_img': VisImage(n_classes=self.n_classes, label_color_map=self.config.data.label_color_map),
            'img_outdir': self.paths.img_outdir,
        }

        trainer = Trainer(**train_parameters)
        trainer.train()