harveyslash / Facial-Similarity-with-Siamese-Networks-in-Pytorch

Implementing Siamese networks with a contrastive loss for similarity learning
https://hackernoon.com/one-shot-learning-with-siamese-networks-in-pytorch-8ddaab10340e
MIT License
971 stars 275 forks source link

Deeper convolutional neural network #37

Open hwh-anton opened 3 years ago

hwh-anton commented 3 years ago

Hello,

I would like to integrate some classic CNN, e.g. AlexNet, VGG16, into this project. Take AlexNet as an example, I discard the last layer of original AlexNet, and use the second last layer to generate a 1*4096 feature vector.

But after the implementation, I found it does not work. The dissimilarity scores for almost all pairs predicted by the model equal zero. Does anyone have idea about that? Or is it possible to integrate those classic and deeper CNN into this project?

harveyslash commented 3 years ago

I am planning to use something like that in the updated version of the project, check out #35 for more details. Instead of training from scratch, we can use the features from something like inception. Training on a larger dataset may also provide more consistent results.

fire717 commented 3 years ago

I have changed to Mobilenet-v3 and run successfully, got even better result than the original model.

I moved the global average pooling and all layers after it, then add 3 FC layer as original model do, and just simply change the number of units.