def _plot_confusion_matrix(self, logger, epoch, confusion_matrix, class_names=None): fig = utils.plot_confusion_matrix(confusion_matrix, class_names=class_names, normalize=True, show=False, **self._plot_params) fig = utils.render_figure_to_tensor(fig) logger.add_image(f"{self.prefix}/epoch", fig, global_step=epoch)
def _log_to_tensorboard(self, image: np.ndarray, logger, step) -> None: fig = plt.figure(figsize=(10, 10)) plt.imshow(image) fig = utils.render_figure_to_tensor(fig) logger.add_image(self.key, fig, global_step=step)