How to compare 1 image to 26 image in siamese neural network

i use siamese network, right now i inser 2 image then will processing an show the answer
if answer is 1 its mean the picture is same, but if answer is 0 its mean the picture is different.

from PIL import Image
x1 ='A.PNG')
x2 ='X.PNG')
# Transform

x1 = transforms(x1)
x2 = transforms(x2)

x1 = torch.stack([x1])
x2 = torch.stack([x2])


# Get prediction
output = model(x1,x2)
output = (torch.sigmoid(output) >= 0.5).float()
print (output)

Both pictures are different, so tensor give this output


I want to ask, I have 26 types of image that I use for this siamese neural network.

Can I insert 1 type of picture and then the image will be compared to the 26 data that I have, if it has a value of 1 (the same picture) can I display which image is the same?

Or can it display the closest range to the image that I entered after comparing into 26 of my data?

Hey, you can create your own data set in which the first image will be repeated 26 times and the other 26 images will remain as they are. Basically, you can create 26 tuples of the images you want to compare. Then you can do the standard Siamese network. Hope this helps :slight_smile: