siamese_model.py
for epoch in range(5):
    total_loss = 0
    
    for imgA, imgB, label in train_dataloader:

        imgA, imgB, label = imgA.cuda(), imgB.cuda(), label.cuda()
        optimizer.zero_grad()
        outputA, outputB = net(imgA, imgB)
        loss_contrastive = criterion(outputA, outputB, label)
        loss_contrastive.backward()

        total_loss += loss_contrastive.item()
        optimizer.step()

    print(f"Epoch {epoch}; Loss {total_loss}")
Epoch 0; Loss 294.239
Epoch 1; Loss 102.846
Epoch 2; Loss 63.365
Epoch 3; Loss 44.616
Epoch 4; Loss 32.775

Loss decreasing

with each epoch