I am trying to use tensorflow js to classify the drawing done on a canvas that is rendered using react-canvas-draw. However, when I try to access the canvas.ref.current it is not an HTMLCanvasElement. E.g code
import * as mobilenet from "@tensorflow-models/mobilenet";
....
const model = await mobilenet.load();
....
<CanvasDraw ref={canvasRef} .../>
<Button onClick={()=>model.classify(canvasRef.current)> Classify </Button>
....
This code fails inside the click handler during classification.
I am trying to use tensorflow js to classify the drawing done on a canvas that is rendered using
react-canvas-draw
. However, when I try to access thecanvas.ref.current
it is not an HTMLCanvasElement. E.g codeThis code fails inside the click handler during classification.
This is the tensorflow model I am using.
Thanks for the help.