def test_finalise(self):
     tracker = SegmentationTracker(MockDataset(), ignore_label=-100)
     tracker.reset("test")
     model = MockModel()
     model.iter = 3
     tracker.track(model)
     tracker.finalise()
     with self.assertRaises(RuntimeError):
         tracker.track(model)
Example #2
0
 def get_tracker(self, wandb_log: bool, tensorboard_log: bool):
     """Factory method for the tracker
     Arguments:
         wandb_log - Log using weight and biases
         tensorboard_log - Log using tensorboard
     Returns:
         [BaseTracker] -- tracker
     """
     return SegmentationTracker(self, wandb_log=wandb_log, use_tensorboard=tensorboard_log)
Example #3
0
    def get_tracker(model, dataset, wandb_log: bool, tensorboard_log: bool):
        """Factory method for the tracker

        Arguments:
            dataset {[type]}
            wandb_log - Log using weight and biases
        Returns:
            [BaseTracker] -- tracker
        """
        return SegmentationTracker(dataset, wandb_log=wandb_log, use_tensorboard=tensorboard_log)
 def test_ignore_label(self):
     tracker = SegmentationTracker(MockDataset(), ignore_label=-100)
     tracker.reset("test")
     model = MockModel()
     model.iter = 3
     tracker.track(model)
     metrics = tracker.get_metrics()
     for k in ["test_acc", "test_miou", "test_macc"]:
         self.assertAlmostEqual(metrics[k], 100, 5)
    def get_tracker(self, wandb_log: bool, tensorboard_log: bool):
        """Factory method for the tracker

        Arguments:
            dataset {[type]}
            wandb_log - Log using weight and biases
        Returns:
            [BaseTracker] -- tracker
        """
        return SegmentationTracker(self,
                                   wandb_log=wandb_log,
                                   use_tensorboard=tensorboard_log,
                                   ignore_label=IGNORE_LABEL)
    def test_track(self):
        tracker = SegmentationTracker(MockDataset())
        model = MockModel()
        tracker.track(model)
        metrics = tracker.get_metrics()
        for k in ["train_acc", "train_miou", "train_macc"]:
            self.assertAlmostEqual(metrics[k], 100, 5)

        model.iter += 1
        tracker.track(model)
        metrics = tracker.get_metrics()
        for k in ["train_acc", "train_macc"]:
            self.assertEqual(metrics[k], 50)
        self.assertAlmostEqual(metrics["train_miou"], 25, 5)
        self.assertEqual(metrics["train_loss_1"], 1.5)

        tracker.reset("test")
        model.iter += 1
        tracker.track(model)
        metrics = tracker.get_metrics()
        for k in ["test_acc", "test_miou", "test_macc"]:
            self.assertAlmostEqual(metrics[k], 0, 5)