File tree Expand file tree Collapse file tree 3 files changed +3
-3
lines changed Expand file tree Collapse file tree 3 files changed +3
-3
lines changed Original file line number Diff line number Diff line change @@ -44,7 +44,7 @@ class Handpose extends EventEmitter {
44
44
modelType : this . config ?. modelType ?? "full" , // use full version of the model by default
45
45
solutionPath : "https://cdn.jsdelivr.net/npm/@mediapipe/hands" , // fetch model from mediapipe server
46
46
} ;
47
-
47
+ await tf . ready ( ) ;
48
48
this . model = await handPoseDetection . createDetector ( pipeline , modelConfig ) ;
49
49
50
50
this . modelReady = true ;
Original file line number Diff line number Diff line change @@ -113,6 +113,7 @@ class DiyNeuralNetwork {
113
113
* @param {* } callback
114
114
*/
115
115
init ( callback ) {
116
+ tf . setBackend ( "webgl" ) ;
116
117
// check if the a static model should be built based on the inputs and output properties
117
118
if ( this . options . noTraining === true ) {
118
119
this . createLayersNoTraining ( ) ;
Original file line number Diff line number Diff line change @@ -78,10 +78,9 @@ class PoseDetection extends EventEmitter {
78
78
bodyPoseDetection . movenet . modelType . MULTIPOSE_LIGHTNING ;
79
79
}
80
80
// Load the detector model
81
- await tf . setBackend ( "webgl" ) ;
81
+ await tf . ready ( ) ;
82
82
this . model = await bodyPoseDetection . createDetector ( pipeline , modelConfig ) ;
83
83
this . modelReady = true ;
84
-
85
84
if ( this . video ) {
86
85
this . predict ( ) ;
87
86
}
You can’t perform that action at this time.
0 commit comments