Skip to content

Commit 224e094

Browse files
committed
added tf.ready()
1 parent 9d7f1a6 commit 224e094

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

src/Handpose/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ class Handpose extends EventEmitter {
4444
modelType: this.config?.modelType ?? "full", // use full version of the model by default
4545
solutionPath: "https://cdn.jsdelivr.net/npm/@mediapipe/hands", // fetch model from mediapipe server
4646
};
47-
47+
await tf.ready();
4848
this.model = await handPoseDetection.createDetector(pipeline, modelConfig);
4949

5050
this.modelReady = true;

src/NeuralNetwork/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@ class DiyNeuralNetwork {
113113
* @param {*} callback
114114
*/
115115
init(callback) {
116+
tf.setBackend("webgl");
116117
// check if the a static model should be built based on the inputs and output properties
117118
if (this.options.noTraining === true) {
118119
this.createLayersNoTraining();

src/PoseDetection/index.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,10 +78,9 @@ class PoseDetection extends EventEmitter {
7878
bodyPoseDetection.movenet.modelType.MULTIPOSE_LIGHTNING;
7979
}
8080
// Load the detector model
81-
await tf.setBackend("webgl");
81+
await tf.ready();
8282
this.model = await bodyPoseDetection.createDetector(pipeline, modelConfig);
8383
this.modelReady = true;
84-
8584
if (this.video) {
8685
this.predict();
8786
}

0 commit comments

Comments
 (0)