Coder Social home page Coder Social logo

Comments (5)

PINTO0309 avatar PINTO0309 commented on June 16, 2024

There is a lack of normalization of the input image and a lack of numerical conversion after inference.

img = cv2.imread('2-1.jpg')
img = cv2.resize(img, (128, 128))
img = cv2.cvtColor(img, cv2.COLOR_BGR2RGB)
img = img - 127.5
img = img * 0.007843
image_np_expanded = np.expand_dims(img, axis=0)

(pred_classificators , pred_regressors) = persistent_sess.run([classificators , regressors],
        feed_dict={img_inputs_face: image_np_expanded})

scores = 1.0 / (1.0 + np.exp(-pred_classificators))
print('scores:', scores)
print('pred_regressors:', pred_regressors)
scores: [[[1.92749663e-04]
  [3.74617724e-04]
  [6.53379102e-05]
  [7.41685581e-05]
  [5.91813914e-05]
  [2.26559394e-04]
  [1.27456326e-04]
  [1.55236325e-04]
  [2.33076513e-04]
  [2.11102131e-04]
   : 
   :

pred_regressors: [[[ -1.0449376    0.12775415  21.445286   ...  -1.3779925    2.7564733
    -4.6433153 ]
  [ -0.97221917   0.34412926  26.561253   ...  -0.48758936   3.127716
    -6.060492  ]
  [ -0.5468276   -1.4531596   20.107094   ...  -1.6310003    6.432667
    -6.4479685 ]
  ...
  [ -1.5552132   -6.239525    86.65577    ... -15.01696     12.402348
     3.2532141 ]
  [ -1.292839    -8.317465    96.59374    ... -16.379583    14.803879
     1.740176  ]
  [ -1.857463   -10.383455   107.36553    ... -20.176395    18.376274
    -0.34014758]]]

from pinto_model_zoo.

sonfire186 avatar sonfire186 commented on June 16, 2024

I get very low score of 0.00013611263 .... 8.4253545e-05How to interpret in normal probabilities 0% - 100%?

from pinto_model_zoo.

Laubeee avatar Laubeee commented on June 16, 2024

There is a lack of normalization of the input image and a lack of numerical conversion after inference.

img = img - 127.5
img = img * 0.007843

I understand the input has to be normalized [-1 ... 1] not [0...1] (as documented in the model card but to be fair they also are missing the z value in the output..)

May I ask where you got it from? Is this meant to support mean-subtraction, and, in that case, shouldn't the mean values of the training set be used?
In any case, the output I get is quite similar for both ranges..

Edit: The new model you recently added has an additional value for every keypoint... any idea what it is?

from pinto_model_zoo.

PINTO0309 avatar PINTO0309 commented on June 16, 2024

I understand that I need to calibrate using the data set used during training. I will follow the exact description in the document if there is one. The normalization range was used in a crude way to predict a likely value. This is because I don't know the correct way to normalize. I don't know the data set either.

If you guys are dissatisfied with the accuracy, you can easily invert the model using the tool below. The dataset used for calibration and the range of normalization can be changed by yourself by adjusting the tool parameters. The last model I converted only used this tool to perform a normalization of RGB/255. But I don't know the certainty of that value.
https://github.com/PINTO0309/tflite2tensorflow
1

from pinto_model_zoo.

Laubeee avatar Laubeee commented on June 16, 2024

I'm not sure I get the concept of what you propose, wouldn't setting custom normalization values have to affect all the model weights too?

from pinto_model_zoo.

Related Issues (20)

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.