mndar/facenet_classifier

Getting nan values as output of feature extraction

Opened this issue · 12 comments

I am trying to use the code , but when I run it, I get all the 128 values as nan for an image.
Could you please let me know if there is any way to resolve it

mndar commented

Is the image 160x160 in size?
Please upload the image so that I can run it here locally.

Do I need to crop the face manually and resize the cropped face to 160*160 and provide it as input ?

mndar commented

Yes.
The right approach would be to do it using code.

Could you please check with above image

mndar commented

This is happening as a result of some linking issue in programs using both OpenCV and Tensorflow.
OpenCV's imread reports the image as empty and of size 0x0 when I compile the program and link it to the Tensorflow C++ library.
Exporting the image to PNG does not cause this problem.

Thanks, in case you are able to resolve the issue related to .jpg image, please let me know.

mndar commented

Compiling Tensorflow without JPEG support using the Makefile method, resolved this issue.
These files should help you get it up and running:

  1. http://czarsoftech.com/opensource/downloads/tensorflow/Makefile
  2. http://czarsoftech.com/opensource/downloads/tensorflow/tensorflow_gentoo_armv7a.md

@mndar ,hello

I had the same problem, I typed in a JPG image,output is nan,like this:
Input Tensor: Tensor<type: float shape: [1,160,160,3] values: [[[-6.67727e-20 -7.17718596e-14 -4.4635304e-21]]]...> Output: Tensor<type: float shape: [1,128] values: [-nan -nan -nan]...>

and I can't open the two links you gave us
http://czarsoftech.com/opensource/downloads/tensorflow/Makefile
http://czarsoftech.com/opensource/downloads/tensorflow/tensorflow_gentoo_armv7a.md
2.
Sometimes I type the same picture. After create_input_tensor, input_tensor and output like this :
Input Tensor: Tensor<type: float shape: [1,160,160,3] values: [[[0 0 0]]]...> Output: Tensor<type: float shape: [1,128] values: [-0.0430219844 -0.115585402 -0.0228054579]...> Output Mat: [128 x 1]
please help me,thanks

How to solve this problem,output values is nan
Output: Tensor<type: float shape: [1,128] values: [-nan -nan -nan]...>

ok,This is due to the input image size (160x160)