TypeError: Cannot read properties of null (reading 'features') at Object.factory (https://unpkg.com/ml5@1/dist/ml5.js:257642:21) at async Engine.ready (https://unpkg.com/ml5@1/dist/ml5.js:1326:29) at async src_ImageClassifier_0.loadModel (https://unpkg.com/ml5@1/dist/ml5.js:275782:5)
Could not get context for WebGL version
2
Could not get context for WebGL version
1
Initialization of backend webgl failed
Error: WebGL is not supported on this device at new src_MathBackendWebGL (https://unpkg.com/ml5@1/dist/ml5.js:228977:19) at Object.factory (https://unpkg.com/ml5@1/dist/ml5.js:230022:49) at Engine.initializeBackend (https://unpkg.com/ml5@1/dist/ml5.js:1434:50) at Engine.ready (https://unpkg.com/ml5@1/dist/ml5.js:1326:40) at async src_ImageClassifier_0.loadModel (https://unpkg.com/ml5@1/dist/ml5.js:275782:5)
{{filePath}}
{{width}} x {{height}}
Report Sketch
Oh, that naughty sketch! Please let us know what the issue is below.
Apply Template
Applying this template will reset your sketch and remove all your changes. Are you sure you would like to continue?
Report Sketch
Report Comment
Please confirm that you would like to report the comment below.
We will review your submission and take any actions necessary per our Community Guidelines. In addition to reporting this comment, you can also block the user to prevent any future interactions.
Please report comments only when necessary. Unnecessary or abusive use of this tool may result in your own account being suspended.
Are you sure you want to delete your sketch?
Any files uploaded will be deleted as well.
Forks of this sketch will no longer be attributed to this sketch.
Delete Comment?
This will also delete all the replies to this comment.
Delete this tab? Any code in it will be deleted as well.
Select a collection to submit your sketch
We Need Your Support
Since 2008, OpenProcessing has provided tools for creative coders to learn, create, and share over a million open source projects in a friendly environment.
Niche websites like ours need your continued support for future development and maintenance, while keeping it an ad-free platform that respects your data and privacy!
Please consider subscribing below to show your support with a "Plus" badge on your profile and get access to many other features!
CC Attribution NonCommercial ShareAlike
ml5+TeachableMachine-2024
Levin
xxxxxxxxxx
// Uses: https://unpkg.com/ml5@1/dist/ml5.js
// Model URL, obtained from Teachable Machine.
let imageModelURL = 'https://teachablemachine.withgoogle.com/models/3Z2oOfxPq/';
///'https://teachablemachine.withgoogle.com/models/GEEZvxKqB/'
//
// Classifier Variable
let classifier;
// Video
let video;
// To store the current classification
let currentCategoryLabel = "";
//--------------------------------------------------
// Load the model first
function preload() {
classifier = ml5.imageClassifier(imageModelURL + 'model.json');
}
//--------------------------------------------------
function setup() {
createCanvas(320, 260);
// Create the webcam video
video = createCapture(VIDEO);
video.size(320, 240);
video.hide();
// Start classifying
classifyVideo();
}
//--------------------------------------------------
function draw() {
background('white');
// Draw the webcam video
image(video, 0,0);
// Display the categorization label (if any)
fill('red');
textSize(16);
textAlign(CENTER);
text(currentCategoryLabel, width/2, height-4);
}
//--------------------------------------------------
// Get a prediction for the current video frame
function classifyVideo() {
classifier.classify(video, gotResult);
}
// What to do when the classifier returns a result.
// Note that the order of the arguments (results, error)
// has been swapped since earlier versions of ml5!
function gotResult(results, error) {
// If there is an error
if (error) {
console.error(error);
return;
}
// The results are stored in an array ordered by confidence.
// console.log(results[0]);
currentCategoryLabel = results[0].label;
// Now, trigger classify to happen again!
classifyVideo();
}
See More Shortcuts
Please verify your email to comment
Verify Email
🌈🌈🌈🌈🌈🌈🌈🌈🌈🌈🌈🌈🌈🌈🌈🌈🌈🌈🌈🌈🌈🌈
🌟 Thank you for using ml5.js v1.2.1 🌟
Please read our community statement to ensure
that the use of this software reflects the values
of the ml5.js community:
↳ https://ml5js.org/about
Reporting:
↳ https://github.com/ml5js/ml5-next-gen/issues
↳ Email: info@ml5js.org
🌈🌈🌈🌈🌈🌈🌈🌈🌈🌈🌈🌈🌈🌈🌈🌈🌈🌈🌈🌈🌈🌈
Initialization of backend webgpu failed
TypeError: Cannot read properties of null (reading 'features')
at Object.factory (https://unpkg.com/ml5@1/dist/ml5.js:257642:21)
at async Engine.ready (https://unpkg.com/ml5@1/dist/ml5.js:1326:29)
at async src_ImageClassifier_0.loadModel (https://unpkg.com/ml5@1/dist/ml5.js:275782:5)
Could not get context for WebGL version
2
Could not get context for WebGL version
1
Initialization of backend webgl failed
Error: WebGL is not supported on this device
at new src_MathBackendWebGL (https://unpkg.com/ml5@1/dist/ml5.js:228977:19)
at Object.factory (https://unpkg.com/ml5@1/dist/ml5.js:230022:49)
at Engine.initializeBackend (https://unpkg.com/ml5@1/dist/ml5.js:1434:50)
at Engine.ready (https://unpkg.com/ml5@1/dist/ml5.js:1326:40)
at async src_ImageClassifier_0.loadModel (https://unpkg.com/ml5@1/dist/ml5.js:275782:5)