Last active
September 2, 2020 11:44
-
-
Save seanbenhur/a70824ebe0d05a937d2f8ea8d1656e27 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
# Load the test dataset | |
test_dataset = SiameseDataset(training_csv=testing_csv,training_dir=testing_dir, | |
transform=transforms.Compose([transforms.Resize((105,105)), | |
transforms.ToTensor() | |
]) | |
) | |
test_dataloader = DataLoader(test_dataset,num_workers=6,batch_size=1,shuffle=True) | |
#test the network | |
count=0 | |
for i, data in enumerate(test_dataloader,0): | |
x0, x1 , label = data | |
concat = torch.cat((x0,x1),0) | |
output1,output2 = model(x0.to(device),x1.to(device)) | |
eucledian_distance = F.pairwise_distance(output1, output2) | |
if label==torch.FloatTensor([[0]]): | |
label="Original Pair Of Signature" | |
else: | |
label="Forged Pair Of Signature" | |
imshow(torchvision.utils.make_grid(concat)) | |
print("Predicted Eucledian Distance:-",eucledian_distance.item()) | |
print("Actual Label:-",label) | |
count=count+1 | |
if count ==10: | |
break |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment