Skip to content

Instantly share code, notes, and snippets.

@nhammad
Last active July 30, 2021 22:48
Show Gist options
  • Save nhammad/1756f4e7c62485dd932bac69fb3d1f4c to your computer and use it in GitHub Desktop.
Save nhammad/1756f4e7c62485dd932bac69fb3d1f4c to your computer and use it in GitHub Desktop.
let capture: any = useRef<any>();
let classifier: any = useRef<any>();
//setting up the webcam from p5, and featureExtractor/classifier from ml5
const setup = (p5: p5Types, canvasParentRef: Element) => {
capture.current = p5.createCapture(p5.VIDEO).parent(canvasParentRef);
const featureExtractor = ml5.featureExtractor("MobileNet", {epochs: props.numberOfEpochs}, modelReady);
classifier.current = featureExtractor.classification(
capture.current,
videoReady
);
};
const draw = (p5: p5Types) => {
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment