GithubHelp home page GithubHelp logo

While testing with two dissimilar images (entirely two different subjects) your code says that they are same. about siamese-pytorch HOT 8 CLOSED

Sumes avatar Sumes commented on August 25, 2024
While testing with two dissimilar images (entirely two different subjects) your code says that they are same.

from siamese-pytorch.

Comments (8)

fangpin avatar fangpin commented on August 25, 2024

Hi @Sumes! I can not provide any help with this limited information. Did you use the newest version of this rep? What's your pytorch version? What's the output of your training process, in which I output the prediction accuracy on test dataset after every 100 mini-batchs. You still train your model with batch_size = 1? Anyway, that will be very helpful for our discussion if you can provide your code and output in a jupyter/ipython file.

from siamese-pytorch.

Sumes avatar Sumes commented on August 25, 2024

from siamese-pytorch.

Sumes avatar Sumes commented on August 25, 2024

I did not modify your code. can you please check the output with test batch size equal to one for two entire two image sets (in parallel)?
I think the problem is the with
pred = np.argmax(output)

pred value is zero even if the images are different.

from siamese-pytorch.

fangpin avatar fangpin commented on August 25, 2024

Please refer to this function:

def __getitem__(self, index):
.
There is trick to sample test data. I record the target image in self.img1 and always put the image whose class is same as self.img1 into the first position of each mini-batch. So if the model makes a right prediction, the 'pred = np.argmax(output)' should be 0. Hope that will be helpful. @Sumes

from siamese-pytorch.

Sumes avatar Sumes commented on August 25, 2024

from siamese-pytorch.

Sumes avatar Sumes commented on August 25, 2024

from siamese-pytorch.

Sumes avatar Sumes commented on August 25, 2024

loss_val += loss.data[0]
[10] loss: 0.69245 Took 7.14 s
[20] loss: 0.68544 Took 1.00 s
[30] loss: 0.66013 Took 0.99 s
[40] loss: 0.65271 Took 0.99 s
[50] loss: 0.63055 Took 1.00 s
[60] loss: 0.62372 Took 1.00 s
[70] loss: 0.61123 Took 1.00 s
[80] loss: 0.61168 Took 1.00 s
[90] loss: 0.60554 Took 0.99 s
[100] loss: 0.59638 Took 0.99 s
Pred-argmax: 0
Pred-argmax: 0
Pred-argmax: 0
Pred-argmax: 0
Pred-argmax: 0
Pred-argmax: 0
Pred-argmax: 0
Pred-argmax: 0
Pred-argmax: 0
Pred-argmax: 0
Pred-argmax: 0
Pred-argmax: 0
Pred-argmax: 0
Pred-argmax: 0
Pred-argmax: 0
Pred-argmax: 0
Pred-argmax: 0
Pred-argmax: 0
Pred-argmax: 0
Pred-argmax: 0
Pred-argmax: 0
Pred-argmax: 0
Pred-argmax: 0
Pred-argmax: 0
Pred-argmax: 0
Pred-argmax: 0
Pred-argmax: 0
Pred-argmax: 0
Pred-argmax: 0
Pred-argmax: 0
Pred-argmax: 0
Pred-argmax: 0
Pred-argmax: 0
Pred-argmax: 0
Pred-argmax: 0
Pred-argmax: 0
Pred-argmax: 0
Pred-argmax: 0
Pred-argmax: 0
Pred-argmax: 0
Pred-argmax: 0
Pred-argmax: 0
Pred-argmax: 0
Pred-argmax: 0
Pred-argmax: 0
Pred-argmax: 0
Pred-argmax: 0
Pred-argmax: 0
Pred-argmax: 0
Pred-argmax: 0
Pred-argmax: 0
Pred-argmax: 0
Pred-argmax: 0
Pred-argmax: 0
Pred-argmax: 0
Pred-argmax: 0
Pred-argmax: 0
Pred-argmax: 0
Pred-argmax: 0
Pred-argmax: 0
Pred-argmax: 0
Pred-argmax: 0
Pred-argmax: 0
Pred-argmax: 0
Pred-argmax: 0
Pred-argmax: 0
Pred-argmax: 0
Pred-argmax: 0
Pred-argmax: 0
Pred-argmax: 0
Pred-argmax: 0
Pred-argmax: 0
Pred-argmax: 0
Pred-argmax: 0
Pred-argmax: 0
Pred-argmax: 0
Pred-argmax: 0
Pred-argmax: 0
Pred-argmax: 0
Pred-argmax: 0
Pred-argmax: 0
Pred-argmax: 0
Pred-argmax: 0
Pred-argmax: 0
Pred-argmax: 0
Pred-argmax: 0
Pred-argmax: 0
Pred-argmax: 0
Pred-argmax: 0
Pred-argmax: 0
Pred-argmax: 0
Pred-argmax: 0
Pred-argmax: 0
Pred-argmax: 0
Pred-argmax: 0
Pred-argmax: 0
Pred-argmax: 0
Pred-argmax: 0
Pred-argmax: 0
Pred-argmax: 0

from siamese-pytorch.

Sumes avatar Sumes commented on August 25, 2024

When I am trying to print the value predicted (pred = np.argmax(output)),
with way = , then all the values predicted is 0.
So is this correct. please verify and tell. Pasting what i got below.
[10] loss: 0.69245 Took 7.14 s
[20] loss: 0.68544 Took 1.00 s
[30] loss: 0.66013 Took 0.99 s
[40] loss: 0.65271 Took 0.99 s
[50] loss: 0.63055 Took 1.00 s
[60] loss: 0.62372 Took 1.00 s
[70] loss: 0.61123 Took 1.00 s
[80] loss: 0.61168 Took 1.00 s
[90] loss: 0.60554 Took 0.99 s
[100] loss: 0.59638 Took 0.99 s
Pred-argmax: 0
Pred-argmax: 0
Pred-argmax: 0
Pred-argmax: 0
Pred-argmax: 0
Pred-argmax: 0
Pred-argmax: 0
Pred-argmax: 0
Pred-argmax: 0
Pred-argmax: 0
Pred-argmax: 0
Pred-argmax: 0
Pred-argmax: 0
Pred-argmax: 0
Pred-argmax: 0
Pred-argmax: 0
Pred-argmax: 0
Pred-argmax: 0
Pred-argmax: 0
Pred-argmax: 0
Pred-argmax: 0
Pred-argmax: 0
Pred-argmax: 0
Pred-argmax: 0
Pred-argmax: 0
Pred-argmax: 0
Pred-argmax: 0
Pred-argmax: 0
Pred-argmax: 0
Pred-argmax: 0
Pred-argmax: 0
Pred-argmax: 0
Pred-argmax: 0
Pred-argmax: 0
Pred-argmax: 0
Pred-argmax: 0
Pred-argmax: 0
Pred-argmax: 0
Pred-argmax: 0
Pred-argmax: 0
Pred-argmax: 0
Pred-argmax: 0
Pred-argmax: 0
Pred-argmax: 0
Pred-argmax: 0
Pred-argmax: 0
Pred-argmax: 0
Pred-argmax: 0
Pred-argmax: 0
Pred-argmax: 0
Pred-argmax: 0
Pred-argmax: 0
Pred-argmax: 0
Pred-argmax: 0
Pred-argmax: 0
Pred-argmax: 0
Pred-argmax: 0
Pred-argmax: 0
Pred-argmax: 0
Pred-argmax: 0
Pred-argmax: 0
Pred-argmax: 0
Pred-argmax: 0
Pred-argmax: 0
Pred-argmax: 0
Pred-argmax: 0
Pred-argmax: 0
Pred-argmax: 0
Pred-argmax: 0
Pred-argmax: 0
Pred-argmax: 0
Pred-argmax: 0
Pred-argmax: 0
Pred-argmax: 0
Pred-argmax: 0
Pred-argmax: 0
Pred-argmax: 0
Pred-argmax: 0
Pred-argmax: 0
Pred-argmax: 0
Pred-argmax: 0
Pred-argmax: 0
Pred-argmax: 0
Pred-argmax: 0
Pred-argmax: 0
Pred-argmax: 0
Pred-argmax: 0
Pred-argmax: 0
Pred-argmax: 0
Pred-argmax: 0
Pred-argmax: 0
Pred-argmax: 0
Pred-argmax: 0
Pred-argmax: 0
Pred-argmax: 0
Pred-argmax: 0
Pred-argmax: 0
Pred-argmax: 0
Pred-argmax: 0
Pred-argmax: 0


[100] right: 100 error: 0 precision: 1.000000

from siamese-pytorch.

Related Issues (15)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.