tutorials icon indicating copy to clipboard operation
tutorials copied to clipboard

Negative values when making inference on notebook PytorchTensorflowMnist.ipynb

Open handreyeg opened this issue 4 years ago • 0 comments

I'm using the PytorchTensorflowMnist.ipynb notebook available here.

When I run the code below, the prediction is right (the number in the image is 2), but shouldn't the output variable be the precision value? If it's the precision value, why is it negative? Or what output variable represents and how can I get the precision value?

img = Image.open('assets/two.png').resize((28, 28)).convert('L') 
display(img)
output = tf_rep.run(np.asarray(img, dtype=np.float32)[np.newaxis, np.newaxis, :, :])
print('The digit is classified as ', np.argmax(output))
print(output._0)

The output of the code above is

The digit is classified as 2
[[-697.756   -923.469   0.   -448.76907   -864.5122   -835.3161   -455.5511   -717.3065   -596.7475   -544.3611 ]]

Any help would be appreciated, thanks.

handreyeg avatar Jan 04 '22 21:01 handreyeg