For questions relating to the ML model joint-embedding architecture known as a "Siamese network," aka "Twin network." [Siamese neural network at Wikipedia](https://en.wikipedia.org/wiki/Siamese_neural_network)
Questions tagged [siamese-network]
128 questions
6
votes
1 answer
Evaluating (model.evaluate) with a triplet loss Siamese neural network model - tensorflow
I have trained a Siamese neural network that uses triplet loss. It was a pain, but I think I managed to do it. However, I am struggling to understand how to make evaluations with this model.
The SNN:
def triplet_loss(y_true, y_pred):
margin =…

maxipod
- 79
- 6
4
votes
1 answer
Siamese Network for binary classification with pre-encoded inputs
I want to train a Siamese Network to compare vectors for similarity.
My dataset consist of pairs of vectors and a target column with "1" if they are the same and "0" otherwise (binary classification):
import pandas as pd
# Define train and test…

benhid
- 124
- 1
- 17
4
votes
1 answer
How to Implement Siamese Network using pretrained CNNs in Keras?
I am developing a Siamese Network for Face Recognition using Keras for 224x224x3 sized images. The architecture of a Siamese Network is like this:
For the CNN model, I am thinking of using the InceptionV3 model which is already pretrained in the…

Sarath
- 163
- 5
- 14
4
votes
0 answers
Siamese BiLSTM neural network with Manhattan distance give very different similarity score each time for the same test data
I'm applying Siamese Bidirectional LSTM (BiLSTM) using character-level sequences and embeddings for long texts. The embeddings model is Word2vec, the sequence length is None to handle variable sequence lengths (180-550), the batch size is 8 and the…

MManahi
- 41
- 3
4
votes
2 answers
Pytorch Siamese Network not converging
Good morning everyone
Below is my implementation of a pytorch siamese network. I am using 32 batch size, MSE loss and SGD with 0.9 momentum as optimizer.
class SiameseCNN(nn.Module):
def __init__(self):
super(SiameseCNN, self).__init__()…

Emile Beukes
- 82
- 1
- 6
2
votes
1 answer
I want make positive image and label pairs but I take this error IndexError: list index out of range
I use the face dataset for the siamese network. In this dataset, we have 1000 unique labels(labels are names of the folders), and in each folder, we have 20 images all images in this dataset are 20000.this error is because of this line:
idxB =…

Erfan Sharifi
- 41
- 7
2
votes
0 answers
Could someone explain me what's behind the FaceNet Paper ? (one-shot learning, siamese network and triplet loss)
I'm struggling since about 3 weeks on my One-Shot learning project. I'm trying to unlock my computer with my face. Unfortunately, I'm far from this task.
First, I wanted to understand well the concepts behind one-shot learning and especially triplet…

ThOpaque
- 39
- 6
2
votes
1 answer
Training loss decreases dramatically after first epoch and validation loss unstable
I am using EfficientNet-B0 as a subnet in Siamese network and contrastive loss as a loss function for an image similarity task. My dataset is quite large (27550 images for training) with 2 classes. After the first epoch, the training loss decreases…

ELbafa
- 21
- 2
2
votes
1 answer
Siamese network showing ValueError
I'm using Siamese network for 2000 features with different domains. I want to train on similar pairs and test on dissimilar pair of features. I'm encountering value error when I try to fit the model.
def get_siamese_conv_unit(input):
encoder =…

Minnie
- 67
- 6
2
votes
0 answers
AttributeError: 'NoneType' object has no attribute '_inbound_nodes' Keras
from Config import Config
from FaceDetection.MTCNNDetect import MTCNNDetect
import cv2
import tensorflow as tf
import keras
from keras import backend as K
from keras.layers import Input, Lambda, Dense, Dropout, Convolution2D, MaxPooling2D, Flatten,…

Brijesh Dave
- 21
- 2
2
votes
1 answer
How to use trained siamese network to predict labels for large test set with 100+ classes?
Do I have to compare each test image to an example image from each class? The test set contains around 7400 images across 104 classes. So this would be 7400 x 104 predictions?
Using tensorflow on tpu's I was able to train the model pretty…

Rashan Arshad
- 247
- 3
- 11
1
vote
0 answers
How to compare images using AI?
I have an issue, where I need to compare shapes that appear in images.
The images might show the same thing, but their content might be twisted, turned, ... a conventional algorithm would therefore fail.
There shapes that might appear are…

Fauna Muirgen
- 36
- 5
1
vote
0 answers
Triplet Loss with Cross Entropy Loss?
I'm trying to learn how to use a TripletLoss in a Siamese Network.
My goal is to build a classification siamese model, so I suppose I need both a Triplet Loss to minimize distances and a Cross Entropy Loss for classification.
I managed to build a…

ChiG
- 19
- 1
- 3
1
vote
0 answers
Why loss is not decreasing in a Siamese BERT-Network training (Entity matching task)
I'm trying to finetune a model for an entity matching task (kind of a sentence similarity task).
The idea is that if I give as input two sentences the model should output if they represent the same entity or not. I'm interested in the products'…

pushz
- 21
- 1
1
vote
0 answers
Shape similarity network (that it is not SSIM)
There are many CNNs for object classification and shapes drawing (e.g., square, heart, curved line etc) classification is even simpler.
However, I haven't found yet a robust method for shape quality classification. I.e., given a drawing of a circle,…

Roi Yozevitch
- 197
- 3
- 13