Error in firebase.mlkit.useCustomModel: TypeError: Cannot read property 'trim' of undefined
See original GitHub issueHi. I’m trying to get the MLKit reading my model and the labels for it.
I’ve tried with the Vue Component, but it doesn’t allow to load the component. Then I loaded the still image using the camera. Here’s the method that wants to apply the custom model:
import { MLKitCustomModelResult, useCustomModel } from "nativescript-plugin-firebase/mlkit/custommodel";
useCustomModel({
image: this.image,
localModelFile: '~/custommodel/rust.tflite',
labelsFile: '~/custommodel/rust_labels.txt',
modelInput: [{
shape: [1, 299, 299, 3],
type: 'QUANT',
}],
})
.then((result: MLKitCustomModelResult) => console.log(JSON.stringify(result.result)))
.catch(console.error)
I’m always getting this:
JS: 'Error in firebase.mlkit.useCustomModel: TypeError: Cannot read property \'trim\' of undefined'
JS: TypeError: Cannot read property 'trim' of undefined
I think it is not able to read the file contents. I also checked in the demo-ng, for still images as well for the cam feed, but it seems to happens also for the
Issue Analytics
- State:
- Created 4 years ago
- Comments:10 (4 by maintainers)
Top Results From Across the Web
TypeError: Cannot read property 'trim' of undefined Node Js ...
Answer was simple fix. There was nothing wrong in the code. "location " : "London, UK". Here space in the "location" has caused...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Good point, I’ve added it to the doc: https://github.com/EddyVerbruggen/nativescript-plugin-firebase/blob/master/docs/ML_KIT.md#custom-model-inference
Hey Eddy… I took a look on my repo. I actually was not copying correctly the tflite file nor the txt file. I included both in the webpack config and at that point it didn’t work. I deleted the platforms and node_modules folders and restarted again. After that it recognized the model and I could use my own model.
I guess it’d worth including that instruction in the repo.
Anyways… thank you very much for your help.