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.

tfjs-automl/demo/object_detection gives no predictions

See original GitHub issue

TensorFlow.js version

Not sure… is that the same as the version of tfjs-core that is used? If I check the tfjs-automl package.json, it looks like it is using tfjs-core 1.2.8, but that seems strange as tfjs is at 2.x right? Then again if I check the commits it looks like tfjs-automl was never upgraded to 2.x?

Browser version

Does not seem relevant. Latest Chrome.

Describe the problem or feature request

Predictions always return an empty array.

The reason I cloned this repo and tried the object_detection demo is that this was exactly what I was seeing on my own model… Simply no predictions are returned, just an empty array. So I tried to replace my model with a ‘known good’ one from Google itself, but still the same result. So, thinking I might have some error in my code somewhere, I decided to try the official example in this repo, giving the same result. Empty array…

Code to reproduce the bug / link to feature request

Clone this repo (I am assuming you cloned to C:\ws\tfjs)
In a shell window, browse to C:\ws\tfjs\tfjs-automl\demo\object_detection
yarn
C:\ws\tfjs\tfjs-automl\demo\object_detection>yarn
yarn install v1.12.3
[1/4] Resolving packages...
[2/4] Fetching packages...
info fsevents@1.2.9: The platform "win32" is incompatible with this module.
info "fsevents@1.2.9" is an optional dependency and failed compatibility check. Excluding it from installation.
[3/4] Linking dependencies...
[4/4] Building fresh packages...
Done in 34.04s.
yarn watch
C:\ws\tfjs\tfjs-automl\demo\object_detection>yarn watch
yarn run v1.12.3
$ cross-env NODE_ENV=development parcel index.html --no-hmr --open
Server running at http://localhost:1234
| Building index.html...Browserslist: caniuse-lite is outdated. Please run next command `yarn upgrade`

WARNING: We noticed you're using the `useBuiltIns` option without declaring a core-js version. Currently, we assume version 2.x when no version is passed. Since this default version will likely change in future versions of Babel, we recommend explicitly setting the core-js version you are using via the `corejs` option.

You should also be sure that the version you pass to the `corejs` option matches the version specified in your `package.json`'s `dependencies` section. If it doesn't, you need to run one of the following commands:

  npm install --save core-js@2    npm install --save core-js@3
  yarn add core-js@2              yarn add core-js@3

/ Building index.js...Browserslist: caniuse-lite is outdated. Please run next command `yarn upgrade`

WARNING: We noticed you're using the `useBuiltIns` option without declaring a core-js version. Currently, we assume version 2.x when no version is passed. Since this default version will likely change in future versions of Babel, we recommend explicitly setting the core-js version you are using via the `corejs` option.

You should also be sure that the version you pass to the `corejs` option matches the version specified in your `package.json`'s `dependencies` section. If it doesn't, you need to run one of the following commands:

  npm install --save core-js@2    npm install --save core-js@3
  yarn add core-js@2              yarn add core-js@3

/ Building index.js...Browserslist: caniuse-lite is outdated. Please run next command `yarn upgrade`

WARNING: We noticed you're using the `useBuiltIns` option without declaring a core-js version. Currently, we assume version 2.x when no version is passed. Since this default version will likely change in future versions of Babel, we recommend explicitly setting the core-js version you are using via the `corejs` option.

You should also be sure that the version you pass to the `corejs` option matches the version specified in your `package.json`'s `dependencies` section. If it doesn't, you need to run one of the following commands:

  npm install --save core-js@2    npm install --save core-js@3
  yarn add core-js@2              yarn add core-js@3

√  Built in 13.89s.
Open your browser

Open your browser at http://localhost:1234

Empty array is returned

After you open the page, it takes a few seconds in which inference is running. After that, it should print a JSON with the returned results below the image and draw some boxes on top of the image containing the detected objects, but instead it only prints [] and draws no boxes at all.

Issue Analytics

  • State:open
  • Created 3 years ago
  • Comments:34 (12 by maintainers)

github_iconTop GitHub Comments

1reaction
rthadurcommented, Sep 3, 2020

@tafsiri tried in windows on a loaner laptop , it works well with CPU and WebGL backend , i tried using this codepen example https://codepen.io/tafsiri/pen/zYqzaKr

1reaction
Downloadcommented, Aug 31, 2020

Yes! It works!

@tafsiri Thank you! I have now seen working predictions on my machine for the first time. Finally I have a way forward. You really made my day buddy! I am going to implement using the CPU for now. Later on I might add some code that attempts to do predictions using the GPU and if it succeeds, switch the backend back to GPU for those devices where it works.

I have a consistently reproducing scenario now for this issue with the GPU backend, so if you want me to try out some stuff to narrow down the issue, just let me know. You can reach me at stijndewitt AT gmail DOT com.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Edge TensorFlow.js tutorial | AutoML Vision Object Detection
js Object Detection model trained and exported using AutoML Vision Edge. You will then build a web page that loads the model and...
Read more >
Machine Learning with TensorFlow in JavaScript
Image classification, object detection. To tell the difference, image is a binary yes or no, whereas object detection gives you the bounding box,...
Read more >
Computer Vision: Object Detection and No-Code AI with AutoML
Ideally, we should have an equal number of examples of each class within the dataset to give AutoML the best chance to perform...
Read more >
How to use tensorflow.js in react.js — Object Detection
npx create-react-app tfjs-sentiment cd tfjs-sentiment · npm install @tensorflow/tfjs npm install @tensorflow-models/coco-ssd · npm install react- ...
Read more >
Is a neural network better than Ash at detecting Team Rocket ...
Training CNNs in TensorFlow, object detection models in Google ... src="https://cdn.jsdelivr.net/npm/@tensorflow/tfjs-automl"></script> ...
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