Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

While testing with two dissimilar images (entirely two different subjects) your code says that they are same. #5

Closed
Sumes opened this issue Nov 15, 2018 · 8 comments

Comments

@Sumes
Copy link

Sumes commented Nov 15, 2018

While testing with two dissimilar images (entirely two different subjects) your code says that they are same.

@fangpin
Copy link
Owner

fangpin commented Nov 16, 2018

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.

@Sumes
Copy link
Author

Sumes commented Nov 16, 2018 via email

@Sumes
Copy link
Author

Sumes commented Nov 16, 2018

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.

@fangpin
Copy link
Owner

fangpin commented Nov 16, 2018

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

@Sumes
Copy link
Author

Sumes commented Nov 18, 2018 via email

@Sumes
Copy link
Author

Sumes commented Nov 18, 2018 via email

@Sumes Sumes closed this as completed Nov 29, 2018
@Sumes
Copy link
Author

Sumes commented Nov 29, 2018

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

@Sumes Sumes reopened this Nov 29, 2018
@Sumes
Copy link
Author

Sumes commented Nov 29, 2018

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

@fangpin fangpin closed this as completed Apr 17, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants