ModelDepot / tfjs-yolo-tiny

In-Browser Object Detection using Tiny YOLO on Tensorflow.js
https://modeldepot.io/mikeshi/tiny-yolo-in-javascript
MIT License
531 stars 92 forks source link

No object-detection in live-demo? #3

Closed stvogel closed 6 years ago

stvogel commented 6 years ago

Thanks for this great repo. This was exactly what I was searching for. But when I start the demo no objects are marked. I see the message: "YOLO inference took 4899.555000000001 milliseconds." on the console and tried with the usual classes: "person", "cup", "mobile", "keyboard" ... but nothing is detected. Is there something special to be done?

MikeShi42 commented 6 years ago

That's interesting, it seems like the model is running successfully (though a bit slow). Just to sanity check: you or the objects you're trying are being held still for ~5 seconds in front of your webcam? It could be potentially a lighting/image quality issue as well.

You can clone the demo, and try using tf.fromPixels on a static image and see if it'll properly detect objects. You can do that by swapping out the <video> element with <img> in index.html, and passing in the img element into the Webcam constructor in index.js, and probably commenting out webcam.setup()

senthil090 commented 6 years ago

The static image should have 416 dimension at all?

MikeShi42 commented 6 years ago

The input image should be 416x416(x3 for channels). @senthil090 are you running into the same issue of no objects being detected?

senthil090 commented 6 years ago

@MikeShi42 yes i got a same issue.

MikeShi42 commented 6 years ago

@senthil090 If possible, can you try detecting on this static image and letting me know if you get any detections? Just to eliminate any possibility of it being an image quality issue. https://i.imgur.com/Ojk3PB4.jpg

(Assuming you're testing with tfjs-yolo-tiny-demo) You can detect on a static image by replacing the video element in index.html with an img element with the src pointing to the above image. You can then pass the img element into the Webcam constructor and comment out the webcam.setup() in line 19.

senthil090 commented 6 years ago

@MikeShi42 i checked with the image given by you and replaced the video element. this time i got Error: Indices must be of dtype int32 error in console.

jacobgil commented 6 years ago

@senthil090 If someone encounters the int32 error, I solved this by adding .toInt() to occurrences of: tf.tensor1d(keep_indx) tf.tensor1d(indices_arr) Becomes: tf.tensor1d(keep_indx).toInt() tf.tensor1d(indices_arr).toInt()