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: Based on the provided shape, [1,1,16,32], and dtype float32, the tensor should have 512 values but has 93

See original GitHub issue

Hi! I’m having trouble making the library work on production. Everything works perfect locally. Using angular 4. Here is the code:

const detections: Array<any> = await faceapi.detectAllFaces(this.video, new faceapi.TinyFaceDetectorOptions({ inputSize: 128, scoreThreshold: 0.4 }));

ERROR Error: Uncaught (in promise): Error: Based on the provided shape, [1,1,16,32], and dtype float32, the tensor should have 512 values but has 93 Error: Based on the provided shape, [1,1,16,32], and dtype float32, the tensor should have 512 values but has 93 at c (scripts.208b17eda93ff84a86fa.bundle.js:1) at new t (scripts.208b17eda93ff84a86fa.bundle.js:1) at Function.t.make (scripts.208b17eda93ff84a86fa.bundle.js:1) at Ht (scripts.208b17eda93ff84a86fa.bundle.js:1) at o (scripts.208b17eda93ff84a86fa.bundle.js:1) at $a (scripts.208b17eda93ff84a86fa.bundle.js:1) at scripts.208b17eda93ff84a86fa.bundle.js:1 at Array.forEach (<anonymous>) at scripts.208b17eda93ff84a86fa.bundle.js:1 at Array.forEach (<anonymous>) at c (scripts.208b17eda93ff84a86fa.bundle.js:1) at new t (scripts.208b17eda93ff84a86fa.bundle.js:1) at Function.t.make (scripts.208b17eda93ff84a86fa.bundle.js:1) at Ht (scripts.208b17eda93ff84a86fa.bundle.js:1) at o (scripts.208b17eda93ff84a86fa.bundle.js:1) at $a (scripts.208b17eda93ff84a86fa.bundle.js:1) at scripts.208b17eda93ff84a86fa.bundle.js:1 at Array.forEach (<anonymous>) at scripts.208b17eda93ff84a86fa.bundle.js:1 at Array.forEach (<anonymous>) at S (polyfills.b05dc6a29a1cfeb080d6.bundle.js:1) at polyfills.b05dc6a29a1cfeb080d6.bundle.js:1 at a (main.424b2f298a047510607b.bundle.js:1) at t.invoke (polyfills.b05dc6a29a1cfeb080d6.bundle.js:1) at Object.onInvoke (main.424b2f298a047510607b.bundle.js:1) at t.invoke (polyfills.b05dc6a29a1cfeb080d6.bundle.js:1) at e.run (polyfills.b05dc6a29a1cfeb080d6.bundle.js:1) at polyfills.b05dc6a29a1cfeb080d6.bundle.js:1 at t.invokeTask (polyfills.b05dc6a29a1cfeb080d6.bundle.js:1) at Object.onInvokeTask (main.424b2f298a047510607b.bundle.js:1) $ @ main.424b2f298a047510607b.bundle.js:1 t.handleError @ main.424b2f298a047510607b.bundle.js:1 next @ main.424b2f298a047510607b.bundle.js:1 e.object.i @ main.424b2f298a047510607b.bundle.js:1 e.__tryOrUnsub @ main.424b2f298a047510607b.bundle.js:1 e.next @ main.424b2f298a047510607b.bundle.js:1 e._next @ main.424b2f298a047510607b.bundle.js:1 e.next @ main.424b2f298a047510607b.bundle.js:1 e.next @ main.424b2f298a047510607b.bundle.js:1 e.emit @ main.424b2f298a047510607b.bundle.js:1 (anonymous) @ main.424b2f298a047510607b.bundle.js:1 t.invoke @ polyfills.b05dc6a29a1cfeb080d6.bundle.js:1 e.run @ polyfills.b05dc6a29a1cfeb080d6.bundle.js:1 t.runOutsideAngular @ main.424b2f298a047510607b.bundle.js:1 onHandleError @ main.424b2f298a047510607b.bundle.js:1 t.handleError @ polyfills.b05dc6a29a1cfeb080d6.bundle.js:1 e.runGuarded @ polyfills.b05dc6a29a1cfeb080d6.bundle.js:1 t @ polyfills.b05dc6a29a1cfeb080d6.bundle.js:1 n.microtaskDrainDone @ polyfills.b05dc6a29a1cfeb080d6.bundle.js:1 d @ polyfills.b05dc6a29a1cfeb080d6.bundle.js:1

Also the video is 351x360 pixels

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:22 (1 by maintainers)

github_iconTop GitHub Comments

29reactions
aryehreincommented, Dec 4, 2019

It was actually a different problem - the json files managed to get loaded, but the non extension files (e.g. “age_gender_model-shard1”) weren’t. So what I did - I used my downloaded “weights” folder (and not the cdn), and for each model I :

  1. added a fictional “.shard” extension for the non extension file.
  2. opened the corresponding “…_manifest.json” file and changed the “path” property to the new file name including the “.shard” extension.

For example:

  1. /age_gender_model-shard1 renamed to /age_gender_model-shard1.shard
  2. opened age_gender_model-weights_manifest.json, and changed "paths":["age_gender_model-shard1"] to: "paths":["age_gender_model-shard1.shard"]

Pay attention that some manifest.json files have 2 paths

7reactions
avalanche1commented, Sep 17, 2019

I managed to solve it serving model files from a cdn Use https://gitcdn.xyz/repo/justadudewhohacks/face-api.js/master/weights/ as MODEL_URL

Read more comments on GitHub >

github_iconTop Results From Across the Web

Uncaught Error: Based on the provided shape, [1024,3], the ...
Uncaught Error: Based on the provided shape, [1024,3], the tensor should have 3072 values but has 30 · Could you please provide the...
Read more >
uncaught error error: based on the provided shape ... - You.com
justadudewhohacks/face-api.jsError: Based on the provided shape, [1,1,16,32], and dtype float32, the tensor should have 512 values but has 93#131.
Read more >
Error: The shape of dict['input_tensor'] provided in model ...
Hi, I converted my saved model to model json using tensorflowjs_converter tensorflowjs_converter \ --input_format=tf_saved_model ...
Read more >
TensorFlow.js - Examining tensors with the debugger
For example, we can see the dtype is float32 . ... Remember, we made this tensor have shape 224 x 224 x 3,...
Read more >
Problem in compiling a sequential model - Google Groups
to TensorFlow.js Discussion. I had this an hour ago, and it seems to be caused by the minimizing step. Probably same names should...
Read more >

github_iconTop Related Medium Post

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