I am trying to implement my tensorflow model into my react native expo file. The error i get is
Android Bundling failed
Unable to resolve "./assets/group1-shard1of1.bin" from "App.js"
Which is the correct path due to it finding the .json file that is also within that folder. I have tried to use the exact file path aswell but that does not resolve either.
Therefore i added a metro.config.js file with this code in it:
const { getDefaultConfig } = require('metro-config');
module.exports = (async () => {
const defaultConfig = await getDefaultConfig();
const { assetExts } = defaultConfig.resolver;
return {
resolver: {
// Add bin to assetExts
assetExts: [...assetExts, 'bin', 'json'],
}
};
})();
This does not solve my issue either. The code that the error comes from is:
useEffect(() => {
async function loadModel() {
const tfReady = await tf.ready();
const modelJSON = await require('./assets/model.json');
const modelWeights = await require('./assets/group1-shard1of1.bin');
const model = await tf.loadLayersModel(bundleResourceIO(modelJSON, modelWeights));
setLicensePlateModel(model);
}
loadModel();
}, []);
I think it is something wrong with how it handles .bin file but i am not sure