question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Error in firebase.mlkit.useCustomModel: TypeError: Cannot read property 'trim' of undefined

See original GitHub issue

Hi. 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:closed
  • Created 4 years ago
  • Comments:10 (4 by maintainers)

github_iconTop GitHub Comments

0reactions
mesirendoncommented, Oct 10, 2019

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found