ahmetgunduz / Real-time-GesRec

Real-time Hand Gesture Recognition with PyTorch on EgoGesture, NvGesture, Jester, Kinetics and UCF101
https://arxiv.org/abs/1901.10323
MIT License
627 stars 166 forks source link

confusion matrix #97

Open caofangzhou opened 3 years ago

caofangzhou commented 3 years ago

Thank you for your outstanding work, which is worth learning from me. I have a question for you about confusion matrices. Can you tell me how to call the function of confusion matrices and output the picture Thank you very much!

offline_test: def plot_cm(cm, classes, normalize = True): import seaborn as sns if normalize: cm = cm.astype('float') / cm.sum(axis=1)[:, np.newaxis] print("Normalized confusion matrix") else: print('Confusion matrix, without normalization')

ax= plt.subplot()
sns.heatmap(cm, annot=False, ax = ax); #annot=True to annotate cells

# labels, title and ticks
ax.set_xlabel('Predicted labels');ax.set_ylabel('True labels'); 
plt.xticks(rotation='vertical')
plt.yticks(rotation='horizontal')

Thank you very much!