Comments (4)
I think that all we need is an await tf.ready()
statement in neuralNetwork init
method. #105 (comment)
The ml5.setBackend
function is an oddball because it initializes an asynchronous change but doesn't wait for it (tf.setBackend
is async
). So we need to wait for TF to be fully set up before using it.
from ml5-next-gen.
Adding await tf.ready()
seems to work! However, a new error occurred now that we are using webgpu
backend:
Error: WebGPU readSync is only available for CPU-resident tensors.
at ms.readSync (pose-detection.esm.js:17:87509)
at Engine.readSync (engine.js:943:1)
at Tensor.dataSync (tensor.js:297:1)
at Tensor.arraySync (tensor.js:228:29)
at NeuralNetworkData.js:509:1
at engine.js:328:1
at Engine.scopedRun (engine.js:338:1)
at Engine.tidy (engine.js:327:1)
at Module.tidy (globals.js:175:18)
at NeuralNetworkData.createOneHotEncodings (NeuralNetworkData.js:494:12)
I will try to investigate this further.
from ml5-next-gen.
Over the long term I think that the ideal thing would be to avoid synchronous operations and use .array()
instead of .arraySync()
. However this function is called way deep in a chain so there's a lot of methods that would need to be converted to async
for that to work.
It seems like the error has been fixed by TFJS, not sure what version it was released in. It might be that we need to bump our dependencies.
Fix PR: tensorflow/tfjs#7576
Issue: tensorflow/tfjs#5468
from ml5-next-gen.
Thank you @lindapaiste! I will try to bump the dependencies and see what happens. I agree that switching to async would be ideal over the long term.
from ml5-next-gen.
Related Issues (20)
- add smoothing to BlazePose under `tfjs` HOT 2
- Question about `maskType` HOT 6
- Google search for reference leads to a non existing page HOT 2
- Posenet Model Does Not Load Suddenly HOT 2
- featureExtractor() not working HOT 1
- Uncaught (in promise) TypeError: ml5.flipImage is not a function HOT 1
- TypeError: ml5.objectDetector is not a function HOT 1
- `topk` in the `options` for `imageClassifier` doesn't work HOT 3
- Errors with ml5.js code (from prior to 1.0 release)!
- Configure issue template for ml5-next-gen repo HOT 4
- Use "good first issue" label on issues and add to contributing documentation HOT 1
- Specify version for yarn and node HOT 4
- Code and comment cleanup
- `bodyPose` and `bodySegmentation` failing to preload in p5 instance mode HOT 3
- Why the code can be run as local file normally about in June, but now cannot HOT 13
- `ml5.neuralNetwork` reorders labels that are numerical strings HOT 3
- BodySegmentation: flipped option doesn't work HOT 1
- imageClassifier not working in v1.0.1 HOT 3
- Research using Commitizen for standardizing release commit messages HOT 1
- Hide Debug Log Messages in Production
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ml5-next-gen.