I'm using teachable machine exported model.
const modelJson = require("./assets/models/model.json");
const modelWeights = require("./assets/models/weights.bin");
useEffect(() => {
let checkTf = async () => {
await tf.ready();
const model = await tf.loadLayersModel(bundleResourceIO(modelJson, modelWeights));
setModel(model);
setDisplayText("loaded Models");
setTfReady(true);
};
checkTf();
}, []);
Loaded model in predicting image async function:
const imageTensor = images.next().value;
const prediction = (await model.predict())[0]; //ERROR
const highestPropPred = prediction[0];
can't loading prediction this error:
[Unhandled promise rejection: Error: Error when checking : expected input_1 to have 4 dimension(s), but got array with shape [200,152,3]]