Accuracy, F1-score remains static throughout all the epochs

aleemsidra: <p>I am working on a classification problem using pre-trained VGG16 on imagenet. The training loss and Val loss are changing in each epoch, but the evaluation metrics like accuracy, F1-score, precision, recall remain exactly static throughout the epochs as can be seen in the image attached<div class="lightbox-wrapper"><a class="lightbox" href="https://discuss.pytorch.org/uploads/default/original/3X/4/d/4df492df8c16a68a8198bf6a2d106a5baea1f64c.png" data-download-href="https://discuss.pytorch.org/uploads/default/4df492df8c16a68a8198bf6a2d106a5baea1f64c" title="Screenshot 2021-10-26 at 2.40.52 PM"><img src="https://discuss.pytorch.org/uploads/default/optimized/3X/4/d/4df492df8c16a68a8198bf6a2d106a5baea1f64c_2_690x90.png" alt="Screenshot 2021-10-26 at 2.40.52 PM" data-base62-sha1="b7CLfatv6n8bGmSQgJFY8F72TOk" width="690" height="90" srcset="https://discuss.pytorch.org/uploads/default/optimized/3X/4/d/4df492df8c16a68a8198bf6a2d106a5baea1f64c_2_690x90.png, https://discuss.pytorch.org/uploads/default/optimized/3X/4/d/4df492df8c16a68a8198bf6a2d106a5baea1f64c_2_1035x135.png 1.5x, https://discuss.pytorch.org/uploads/default/optimized/3X/4/d/4df492df8c16a68a8198bf6a2d106a5baea1f64c_2_1380x180.png 2x" data-dominant-color="E0E1E2"><div class="meta"><svg class="fa d-icon d-icon-far-image svg-icon" aria-hidden="true"><use href="#far-image"></use></svg><span class="filename">Screenshot 2021-10-26 at 2.40.52 PM</span><span class="informations">2206×290 91.6 KB</span><svg class="fa d-icon d-icon-discourse-expand svg-icon" aria-hidden="true"><use href="#discourse-expand"></use></svg></div></a></div>.  How can I make sure that evaluation metrics are changing according, as I have to choose the checkpoint based on the best F1-score for the test set. Below is the code for validation and metrics calculation:</p>
<pre><code class="lang-auto">def validate():
    model.eval()

    valid_losses = []
    y_true, y_pred = [], []

    with torch.no_grad():
        for batch, target in valid_loader:
            # move data to the device
            batch = batch.to(device)
            target = target.to(device)
            # make predictions
            predictions = model(batch)
            # calculate loss
            loss = criterion(predictions, target)
            # track losses and predictions
            valid_losses.append(float(loss.item()))
            #print(valid_losses)
            y_true.extend(target.cpu().numpy())
            y_pred.extend(predictions.argmax(dim=1).cpu().numpy())  
    y_true = np.array(y_true)
    y_pred = np.array(y_pred)
    valid_losses = np.array(valid_losses) 
    # calculate the mean validation loss
    valid_loss = valid_losses.mean()
    # return valid_loss, valid_accuracy, macro_f1, macro_p, macro_r, micro_f1, cm
    return valid_loss, y_true, y_pred
</code></pre>
<pre><code class="lang-auto">def evaluation_analysis(y_true, y_pred):

  # calculate validation accuracy from y_true and y_pred
    valid_accuracy = np.mean(y_pred == y_true)
  # macro_average
    macro_f1 =  metrics.f1_score(y_true, y_pred, average='macro')
    macro_p  =  metrics.precision_score(y_true, y_pred, average='macro') 
    macro_r  =  metrics.recall_score(y_true, y_pred, average='macro')
   
    # micro average
    micro_f1 = metrics.f1_score(y_true, y_pred, average='micro')
    # confusion matrix
    cm = metrics.confusion_matrix(y_true, y_pred)

    return acc_score,  macro_f1, macro_p, macro_r, micro_f1, cm```</code></pre>