React Native | Expo : Initialization of backend rn-webgl failed
System information
- Have I written custom code (as opposed to using a stock example script provided in TensorFlow.js):
- Windows 11
- Mobile device : Android emulator
- TensorFlow.js installed from (npm or script link): NPM
- TensorFlow.js version (use command below): "@tensorflow/tfjs-react-native": "^0.6.0"
- Browser version: Not using any Browser | on expo project
- Tensorflow.js Converter Version: no idea
Describe the current behavior Error Loading : [TypeError: Network request failed]
Describe the expected behavior No Errors Should work just Fine
const initializeTfAsync = async () => {
await tf.ready();
setIsTfReady(true);
};
const initializeModelAsync = async () => {
// model.current = await mobilenet.load();
model.current = await tf.loadLayersModel('../assets/tfjs_model/model.json').catch(err=>{console.log("Error Loading :",err);
});
//const model1 = await tf.loadLayersModel('./tfjs_model/model.json')
setIsModelReady(true);
};
const getPermissionAsync = async () => {
if (Platform.OS !== "web") {
const {
status,
} = await ImagePicker.requestMediaLibraryPermissionsAsync();
if (status !== "granted") {
alert("Sorry, we need camera roll permissions to make this work!");
}
}
};
initializeTfAsync();
initializeModelAsync();
getPermissionAsync();
}, []);
Error Loading : [TypeError: Network request failed]
Initialization of backend rn-webgl failed
at node_modules\react-native\Libraries\LogBox\LogBox.js:118:19 in registerWarning
at node_modules\react-native\Libraries\LogBox\LogBox.js:64:23 in warnImpl
at node_modules\react-native\Libraries\LogBox\LogBox.js:37:12 in console.warn
at node_modules\expo\build\environment\react-native-logs.fx.js:18:22 in warn
at node_modules\@tensorflow\tfjs-core\dist\tf-core.node.js:4421:26 in backend.then._catch$argument_0
at node_modules\react-native\node_modules\promise\setimmediate\core.js:37:13 in tryCallOne
at node_modules\react-native\node_modules\promise\setimmediate\core.js:123:24 in setImmediate$argument_0
at node_modules\react-native\Libraries\Core\Timers\JSTimers.js:123:14 in _callTimer
at node_modules\react-native\Libraries\Core\Timers\JSTimers.js:177:14 in _callImmediatesPass
at node_modules\react-native\Libraries\Core\Timers\JSTimers.js:437:30 in callImmediates
at node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:388:30 in __callImmediates
at node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:132:27 in __guard$argument_0
at node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:365:10 in __guard
at node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:131:16 in flushedQueue
promiseMethodWrapper@http://192.168.0.122:19000/node_modules%5Cexpo%5CAppEntry.bundle?platform=android&dev=true&hot=false&strict=false&minify=false:2684:45
http://192.168.0.122:19000/node_modules%5Cexpo%5CAppEntry.bundle?platform=android&dev=true&hot=false&strict=false&minify=false:90642:42
createContextAsync$@http://192.168.0.122:19000/node_modules%5Cexpo%5CAppEntry.bundle?platform=android&dev=true&hot=false&strict=false&minify=false:247930:93
tryCatch@http://192.168.0.122:19000/node_modules%5Cexpo%5CAppEntry.bundle?platform=android&dev=true&hot=false&strict=false&minify=false:21962:23
invoke@http://192.168.0.122:19000/node_modules%5Cexpo%5CAppEntry.bundle?platform=android&dev=true&hot=false&strict=false&minify=false:22100:32
tryCatch@http://192.168.0.122:19000/node_modules%5Cexpo%5CAppEntry.bundle?platform=android&dev=true&hot=false&strict=false&minify=false:21962:23
invoke@http://192.168.0.122:19000/node_modules%5Cexpo%5CAppEntry.bundle?platform=android&dev=true&hot=false&strict=false&minify=false:22021:30
http://192.168.0.122:19000/node_modules%5Cexpo%5CAppEntry.bundle?platform=android&dev=true&hot=false&strict=false&minify=false:22046:19
tryCallTwo@http://192.168.0.122:19000/node_modules%5Cexpo%5CAppEntry.bundle?platform=android&dev=true&hot=false&strict=false&minify=false:25983:9
doResolve@http://192.168.0.122:19000/node_modules%5Cexpo%5CAppEntry.bundle?platform=android&dev=true&hot=false&strict=false&minify=false:26114:25
Promise@http://192.168.0.122:19000/node_modules%5Cexpo%5CAppEntry.bundle?platform=android&dev=true&hot=false&strict=false&minify=false:26002:14
callInvokeWithMethodAndArg@http://192.168.0.122:19000/node_modules%5Cexpo%5CAppEntry.bundle?platform=android&dev=true&hot=false&strict=false&minify=false:22045:33
enqueue@http://192.168.0.122:19000/node_modules%5Cexpo%5CAppEntry.bundle?platform=android&dev=true&hot=false&strict=false&minify=false:22049:157
async@http://192.168.0.122:19000/node_modules%5Cexpo%5CAppEntry.bundle?platform=android&dev=true&hot=false&strict=false&minify=false:22061:69
createContextAsync@http://192.168.0.122:19000/node_modules%5Cexpo%5CAppEntry.bundle?platform=android&dev=true&hot=false&strict=false&minify=false:247925:42
_callee$@http://192.168.0.122:19000/node_modules%5Cexpo%5CAppEntry.bundle?platform=android&dev=true&hot=false&strict=false&minify=false:246248:84
tryCatch@http://192.168.0.122:19000/node_modules%5Cexpo%5CAppEntry.bundle?platform=android&dev=true&hot=false&strict=false&minify=false:21962:23
invoke@http://192.168.0.122:19000/node_modules%5Cexpo%5CAppEntry.bundle?platform=android&dev=true&hot=false&strict=false&minify=false:22100:32
tryCatch@http://192.168.0.122:19000/node_modules%5Cexpo%5CAppEntry.bundle?platform=android&dev=true&hot=false&strict=false&minify=false:21962:23
invoke@http://192.168.0.122:19000/node_modules%5Cexpo%5CAppEntry.bundle?platform=android&dev=true&hot=false&strict=false&minify=false:22021:30
http://192.168.0.122:19000/node_modules%5Cexpo%5CAppEntry.bundle?platform=android&dev=true&hot=false&strict=false&minify=false:22046:19
tryCallTwo@http://192.168.0.122:19000/node_modules%5Cexpo%5CAppEntry.bundle?platform=android&dev=true&hot=false&strict=false&minify=false:25983:9
doResolve@http://192.168.0.122:19000/node_modules%5Cexpo%5CAppEntry.bundle?platform=android&dev=true&hot=false&strict=false&minify=false:26114:25
Promise@http://192.168.0.122:19000/node_modules%5Cexpo%5CAppEntry.bundle?platform=android&dev=true&hot=false&strict=false&minify=false:26002:14
callInvokeWithMethodAndArg@http://192.168.0.122:19000/node_modules%5Cexpo%5CAppEntry.bundle?platform=android&dev=true&hot=false&strict=false&minify=false:22045:33
enqueue@http://192.168.0.122:19000/node_modules%5Cexpo%5CAppEntry.bundle?platform=android&dev=true&hot=false&strict=false&minify=false:22049:157
async@http://192.168.0.122:19000/node_modules%5Cexpo%5CAppEntry.bundle?platform=android&dev=true&hot=false&strict=false&minify=false:22061:69
_callee@http://192.168.0.122:19000/node_modules%5Cexpo%5CAppEntry.bundle?platform=android&dev=true&hot=false&strict=false&minify=false:246243:42
initializeBackend@http://192.168.0.122:19000/node_modules%5Cexpo%5CAppEntry.bundle?platform=android&dev=true&hot=false&strict=false&minify=false:161723:51
http://192.168.0.122:19000/node_modules%5Cexpo%5CAppEntry.bundle?platform=android&dev=true&hot=false&strict=false&minify=false:161590:48
step@http://192.168.0.122:19000/node_modules%5Cexpo%5CAppEntry.bundle?platform=android&dev=true&hot=false&strict=false&minify=false:158804:25
http://192.168.0.122:19000/node_modules%5Cexpo%5CAppEntry.bundle?platform=android&dev=true&hot=false&strict=false&minify=false:158726:73
tryCallTwo@http://192.168.0.122:19000/node_modules%5Cexpo%5CAppEntry.bundle?platform=android&dev=true&hot=false&strict=false&minify=false:25983:9
doResolve@http://192.168.0.122:19000/node_modules%5Cexpo%5CAppEntry.bundle?platform=android&dev=true&hot=false&strict=false&minify=false:26114:25
Promise@http://192.168.0.122:19000/node_modules%5Cexpo%5CAppEntry.bundle?platform=android&dev=true&hot=false&strict=false&minify=false:26002:14
__awaiter@http://192.168.0.122:19000/node_modules%5Cexpo%5CAppEntry.bundle?platform=android&dev=true&hot=false&strict=false&minify=false:158708:36
_callee$@http://192.168.0.122:19000/node_modules%5Cexpo%5CAppEntry.bundle?platform=android&dev=true&hot=false&strict=false&minify=false:136113:59
tryCatch@http://192.168.0.122:19000/node_modules%5Cexpo%5CAppEntry.bundle?platform=android&dev=true&hot=false&strict=false&minify=false:21962:23
invoke@http://192.168.0.122:19000/node_modules%5Cexpo%5CAppEntry.bundle?platform=android&dev=true&hot=false&strict=false&minify=false:22100:32
tryCatch@http://192.168.0.122:19000/node_modules%5Cexpo%5CAppEntry.bundle?platform=android&dev=true&hot=false&strict=false&minify=false:21962:23
invoke@http://192.168.0.122:19000/node_modules%5Cexpo%5CAppEntry.bundle?platform=android&dev=true&hot=false&strict=false&minify=false:22021:30
http://192.168.0.122:19000/node_modules%5Cexpo%5CAppEntry.bundle?platform=android&dev=true&hot=false&strict=false&minify=false:22046:19
tryCallTwo@http://192.168.0.122:19000/node_modules%5Cexpo%5CAppEntry.bundle?platform=android&dev=true&hot=false&strict=false&minify=false:25983:9
doResolve@http://192.168.0.122:19000/node_modules%5Cexpo%5CAppEntry.bundle?platform=android&dev=true&hot=false&strict=false&minify=false:26114:25
Promise@http://192.168.0.122:19000/node_modules%5Cexpo%5CAppEntry.bundle?platform=android&dev=true&hot=false&strict=false&minify=false:26002:14
callInvokeWithMethodAndArg@http://192.168.0.122:19000/node_modules%5Cexpo%5CAppEntry.bundle?platform=android&dev=true&hot=false&strict=false&minify=false:22045:33
enqueue@http://192.168.0.122:19000/node_modules%5Cexpo%5CAppEntry.bundle?platform=android&dev=true&hot=false&strict=false&minify=false:22049:157
async@http://192.168.0.122:19000/node_modules%5Cexpo%5CAppEntry.bundle?platform=android&dev=true&hot=false&strict=false&minify=false:22061:69
_callee@http://192.168.0.122:19000/node_modules%5Cexpo%5CAppEntry.bundle?platform=android&dev=true&hot=false&strict=false&minify=false:136108:42
http://192.168.0.122:19000/node_modules%5Cexpo%5CAppEntry.bundle?platform=android&dev=true&hot=false&strict=false&minify=false:136168:24
invokePassiveEffectCreate@http://192.168.0.122:19000/node_modules%5Cexpo%5CAppEntry.bundle?platform=android&dev=true&hot=false&strict=false&minify=false:18870:32
invokeGuardedCallbackProd@http://192.168.0.122:19000/node_modules%5Cexpo%5CAppEntry.bundle?platform=android&dev=true&hot=false&strict=false&minify=false:7768:21
invokeGuardedCallback@http://192.168.0.122:19000/node_modules%5Cexpo%5CAppEntry.bundle?platform=android&dev=true&hot=false&strict=false&minify=false:7854:42
flushPassiveEffectsImpl@http://192.168.0.122:19000/node_modules%5Cexpo%5CAppEntry.bundle?platform=android&dev=true&hot=false&strict=false&minify=false:18928:36
unstable_runWithPriority@http://192.168.0.122:19000/node_modules%5Cexpo%5CAppEntry.bundle?platform=android&dev=true&hot=false&strict=false&minify=false:45568:30
http://192.168.0.122:19000/node_modules%5Cexpo%5CAppEntry.bundle?platform=android&dev=true&hot=false&strict=false&minify=false:18749:36
workLoop@http://192.168.0.122:19000/node_modules%5Cexpo%5CAppEntry.bundle?platform=android&dev=true&hot=false&strict=false&minify=false:45529:48
flushWork@http://192.168.0.122:19000/node_modules%5Cexpo%5CAppEntry.bundle?platform=android&dev=true&hot=false&strict=false&minify=false:45508:28
_flushCallback@http://192.168.0.122:19000/node_modules%5Cexpo%5CAppEntry.bundle?platform=android&dev=true&hot=false&strict=false&minify=false:45268:24
_callTimer@http://192.168.0.122:19000/node_modules%5Cexpo%5CAppEntry.bundle?platform=android&dev=true&hot=false&strict=false&minify=false:26329:17
callTimers@http://192.168.0.122:19000/node_modules%5Cexpo%5CAppEntry.bundle?platform=android&dev=true&hot=false&strict=false&minify=false:26495:19
__callFunction@http://192.168.0.122:19000/node_modules%5Cexpo%5CAppEntry.bundle?platform=android&dev=true&hot=false&strict=false&minify=false:3112:36
http://192.168.0.122:19000/node_modules%5Cexpo%5CAppEntry.bundle?platform=android&dev=true&hot=false&strict=false&minify=false:2881:31
__guard@http://192.168.0.122:19000/node_modules%5Cexpo%5CAppEntry.bundle?platform=android&dev=true&hot=false&strict=false&minify=false:3071:15
callFunctionReturnFlushedQueue@http://192.168.0.122:19000/node_modules%5Cexpo%5CAppEntry.bundle?platform=android&dev=true&hot=false&strict=false&minify=false:2880:21
callFunctionReturnFlushedQueue@[native code]
at node_modules\react-native\Libraries\LogBox\LogBox.js:118:19 in registerWarning
at node_modules\react-native\Libraries\LogBox\LogBox.js:64:23 in warnImpl
at node_modules\react-native\Libraries\LogBox\LogBox.js:37:12 in console.warn
at node_modules\expo\build\environment\react-native-logs.fx.js:18:22 in warn
at node_modules\@tensorflow\tfjs-core\dist\tf-core.node.js:4422:32 in backend.then._catch$argument_0
at node_modules\react-native\node_modules\promise\setimmediate\core.js:37:13 in tryCallOne
at node_modules\react-native\node_modules\promise\setimmediate\core.js:123:24 in setImmediate$argument_0
at node_modules\react-native\Libraries\Core\Timers\JSTimers.js:123:14 in _callTimer
at node_modules\react-native\Libraries\Core\Timers\JSTimers.js:177:14 in _callImmediatesPass
at node_modules\react-native\Libraries\Core\Timers\JSTimers.js:437:30 in callImmediates
at node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:388:30 in __callImmediates
at node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:132:27 in __guard$argument_0
at node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:365:10 in __guard
at node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:131:16 in flushedQueue
image path : Object {
"uri": "file:///data/user/0/host.exp.exponent/cache/ExperienceData/%2540sourabh58%252Fimage-object-detection/ImageManipulator/ea240ea2-7f87-4565-be7b-1b082934880d.jpg",
}
Exception Error: [TypeError: undefined is not an object (evaluating 'model.current.classify')]
Can you please check a related issue here https://github.com/tensorflow/tfjs/issues/3186 , thank you
Can you please check a related issue here #3186 , thank you
its a different issue I think it has to do with loading of the model
model.current = await tf.loadLayersModel(bundleResourceIO(modelJSON, [modelWeights1,modelWeights2,modelWeights3,modelWeights4,modelWeights5,modelWeights6,modelWeights7,modelWeights8,modelWeights9,modelWeights10,modelWeights11,modelWeights12,modelWeights13,modelWeights14,modelWeights15])).catch((e)=>{
console.log("[LOADING ERROR] info:",e)
})
bro is there a way to run model.predict in another thread as model.predict() is blocking my ui thread hence there is a physical lag in my camera with tensors ?
Hi, @SSOURABH58
Apologize for the delayed response, May I know your issue got resolved or still are you looking for help with your issue ? if yes, If you could provide me with a minimal code example and model which you're using that reproduces the issue, it would be very helpful in debugging the problem. Thank you!
Meanwhile, could you please refer this official documentation and try with mentioned package dependancies in that official documentation, see is it resolving your issue or not ? Thank you!
"expo": "~44.0.2",
"expo-camera": "^12.1.0",
"expo-file-system": "^13.2.0",
"expo-gl": "^11.1.1",
"expo-gl-cpp": "^11.1.0",
"react": "17.0.1",
"react-native": "~0.64.3",
This issue has been marked stale because it has no recent activity since 7 days. It will be closed if no further activity occurs. Thank you.
This issue was closed due to lack of activity after being marked stale for past 7 days.