def evaluate(self): """Predicts resuts for the test dataset""" LOG.info('\n Prediction started...') self._set_training_parameters() eval_parameters = { 'device': self.device, 'model': self.model, 'dataloaders': (self.trainloader, self.testloader), 'epochs': None, 'optimizer': self.optimizer, 'criterion': self.criterion, 'metrics': self.metric, 'save_ckpt_interval': None, 'ckpt_dir': self.paths.ckpt_dir, 'summary_dir': self.paths.summary_dir, } trainer = Trainer(**eval_parameters) trainer.eval()
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 evaluate(self): """Predicts resuts for the test dataset""" LOG.info('\n Prediction started...') self._set_training_parameters() eval_parameters = { 'device': self.device, 'model': self.model, 'dataloaders': (self.trainloader, self.testloader), 'epochs': None, 'optimizer': self.optimizer, 'criterion': self.criterion, 'metrics': self.metric, 'save_ckpt_interval': None, '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(**eval_parameters) trainer.eval(epoch=0, inference=True)
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()