How to use a predict function with models converted to react native

302 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.

const loadMobileNetModel = async () => {
    const modelJson = require('./model.json');
    const modelWeights= require('./weights.bin');
    const model = await tf.loadGraphModel(bundleResourceIO(modelJson, modelWeights));
    setModelFound(true);
    return model;
  }
 
  const getPrediction = async(tensor) => {

     const results = await mobilenetModel.predict(tensor).dataSync();
  }

Output of the model:

0.20394186675548553
212.1569366455078
221.74099731445312
207.11045837402344
0

There are 0 best solutions below