I have a model which I trained and is stored as h5 file, I used tensorflowJs converter to convert it to json file and weights. I'm using expo, and I want to load that model, I understand that bundleResourceIO doesn't work with exp and I'm suppose to load it from a webserver, but I cannot find any tutorial or guide, is that even possible?
Importing your own tensorflow model to react native
4.6k Views Asked by Alexander At
2
There are 2 best solutions below
0

I have resolved the issue by adding a metro.config.js file. Add the follow code into the file so that it is able to read the bin file.
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'],
}
};
})();
If you need a video guide watch this: https://www.youtube.com/watch?v=pC7mCEHiYQw
You can use bundleResourceIO.
If you have multiple bin files then reconvert it again and set
--weight_shard_size_bytes 60000000
this sets the maximum size of theweight_shard_size_bytes
file to 60Mb.Dependencies: