Open Danielvenzi opened 3 years ago
Hello. valid_detections is undefined
means that this variable is not assigned. You could add a breakpoint on the line
80 | const [boxes, scores, classes, valid_detections] = res;
, and inspect the values of boxes, scores, classes, valid_detections
to check whether they are assigned.
@Danielvenzi This issue may be related to https://github.com/zldrobit/tfjs-yolov5-example/issues/2. Plz update tfjs to 3.9.0 and try again. You could use the latest commit of this repo and run npm install
to upgrade tfjs.
Hello, I'm trying to test the yolov5s to tensorflow.js conversion with a example image of the default 320x320 size, but when i put it on the "Choose or drop a file" at the web app i receive immediately the "valid_detections is undefined" error on the index.js:82 .
79 | 80 | const [boxes, scores, classes, valid_detections] = res; 81 | var i; -> 82 | for (i = 0; i < valid_detections.dataSync()[0]; ++i){ | ^ let [x1, y1, x2, y2] = boxes.dataSync().slice(i 4, (i + 1) 4); 84 | x1 = c.width; 85 | x2 = c.width;
I'm using the default yolov5s model to test this functionality with a image that has classes that the model can detect, i resized the image previous to the test in order to avoid errors, but i don't seem to know why this problem is happening. Do you have any idea?