Predictions are returning strange values

147 Views Asked by At

I'm trying to make a prediction, but the values of the output are very strange and out of the ordinary, I used the same model in another application made in android studio and in another format ('pb' 'txt)' and it was working, I converted to stay compatible with React Native and the output values do not match what I expected. Values exceed 100%

const loadMobileNetModel = async () => {
  const model = await tf.loadGraphModel(bundleResourceIO(modelJson, modelWeights));
  setModelFound(true);
  return model;
  }

const getPrediction = async(tensor) => {
 const results = await mobilenetModel.predict(tensor).dataSync()[0];
 console.log(results);
}

const handleCameraStream = (imageAsTensors) => {
const loop = async () => {

  if(modelFound){
    const verbose = true;
    const nextImageTensor = await imageAsTensors.next().value;
    const floatImageTensor = tf.cast(nextImageTensor, 'float32');
    const ReshapeImageTensor = floatImageTensor.reshape([1, 416, 416, 3]);
    await getPrediction(ReshapeImageTensor);
  }

Outputs: 19.368160247802734 22.82789421081543 18.992399215698242 36.17805099487305 30.855012893676758 97.73448944091797 -1205.3101806640625 -126.22428894042969 148.76333618164062 ...

0

There are 0 best solutions below