This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def print_confusion_matrix(confusion_matrix, class_names, figsize = (10,7), fontsize=14): | |
df_cm = pd.DataFrame(confusion_matrix, index=class_names, columns=class_names) | |
fig = plt.figure(figsize=figsize) | |
try: | |
heatmap = sns.heatmap(df_cm, annot=True, fmt="d") | |
except ValueError: | |
raise ValueError("Confusion matrix values must be integers.") | |
heatmap.yaxis.set_ticklabels(heatmap.yaxis.get_ticklabels(), rotation=0, ha='right', fontsize=fontsize) | |
heatmap.xaxis.set_ticklabels(heatmap.xaxis.get_ticklabels(), rotation=45, ha='right', fontsize=fontsize) | |
plt.ylabel('True label') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pathlib | |
import numpy as np | |
import cv2 | |
from tensorboard.backend.event_processing import event_accumulator | |
event_filepath = 'runs/Apr19_11-02-02_RNSCWL0127/events.out.tfevents.1713517322.RNSCWL0127.15332.0' | |
output_dir = 'images/img_train' | |
event_acc = event_accumulator.EventAccumulator(event_filepath, size_guidance={'images': 0}) |