Closed taeyzzz closed 6 years ago
Can you post the actual error message that you get in the catch clause?
@reneweb I've been encountering the same thing, getting Error: Could not load resource
when running off the .apk and not metro bundler.
I've had a look and there was an issue when loading the resources in release mode. I've just released version 0.1.4 which should fix this issue.
i've tried with new version. it still always call in catch when i build cd android && ./gradlew assembleRelease
and this is my code
` const tfImageRecognition = new TfImageRecognition({ model: require('../../model.pb'), labels: require('../../label.txt'), imageMean: 117, // Optional, defaults to 117 imageStd: 1 // Optional, defaults to 1 })
tfImageRecognition.recognize({
image: this.state.imagePath,
inputName: "input_1", //Optional, defaults to "input"
inputSize: 224, //Optional, defaults to 224
outputName: "k2tfout_0", //Optional, defaults to "output"
maxResults: 3, //Optional, defaults to 3
threshold: 0.1, //Optional, defaults to 0.1
}).then(results => {
results.forEach(result => {
console.log('result -------------------');
console.log(
result.id, // Id of the result
result.name, // Name of the result
result.confidence // Confidence value between 0 - 1
)
alert(result.name) //when run with metro bundler. it will be working good
})
})
.catch(err => {
alert('tensorflow error') // always alert when i build apk and try in real device
console.log('errorrrrrrrrrrrrrrrrrrrrr');
console.log(err);
})
` and this is version that i've tried
"react-native-tensorflow": "^0.1.6"
Thank you @reneweb
I'm using tensorflow to detect data if true or false. It work perfectly on emulator device but after I generate .apk and run on real device. It always cause the error. below is my code
when function tfImageRecognition.recognize was called it always throw error to .catch