1. Learn
  2. /
  3. Courses
  4. /
  5. Introduction to Deep Learning with PyTorch

Connected

Exercise

Calculating accuracy using torchmetrics

Tracking accuracy during training helps identify the best-performing epoch.

In this exercise, you'll use torchmetrics to calculate accuracy on a facemask dataset with three classes. The plot_errors function will highlight misclassified samples, helping you analyze model errors.

torchmetrics package is already imported. Model outputs are softmax probabilities, and labels are one-hot encoded vectors.

Instructions 1/2

undefined XP
    1
    2
  • Create a "multiclass" accuracy metric with three classes.
  • Calculate the accuracy for each batch of the dataloader.