WICG / shape-detection-api

Detection of shapes (faces, QR codes) in images
https://wicg.github.io/shape-detection-api
Other
306 stars 36 forks source link

maxDetectedFaces not working, what about fastMode? #39

Closed kostadinnm closed 6 years ago

kostadinnm commented 6 years ago

Hello. I've been playing with the api. I am about to try to utilize it in a small desktop app, which is already a bit heavy. Although limiting the number of faces detected won't matter in my case, it came strange to me that this option doesn't work. Here are the results of the simple test I made:

one face: one_face

24 faces(all detected, although only 2 were requested): 24_faces

Actually, reading the draft kind of left me with the impression that those two options(along with fastMode) had never been implemented, but I just wanted to share it here, so that it's clear for anyone else :) Always feel free to correct me!

Cheers, Kostadin

yell0wd0g commented 6 years ago

The actual implementation depends on the platform and its versions ATM :

What's your platform? Can you use another?

kostadinnm commented 6 years ago

I plan to utilize it to enhance user activity detection within stretcly, which is

a cross-platform electron app that reminds you to take breaks when working with computer

I'm on windows 10 now, but it'be great if it works in linux and windows 7 as well. For now, I'll go w/o passing any params to FaceDetector. Performance-wise, it'll be better if it allows me to opt for single face detection and fastMode, I guess. I'd been looking at tracking.js, then I realized it uses clmtrackr.js, which in turn uses js-objectdetect(correct me if I'm wrong), whose page has a comparison with jsfeat. The latter seemed inapplicable, but most recent. But then I found the shape detection api, which works surprising well and is keeping my believes on enhancing stretchly for now.

yell0wd0g commented 6 years ago

but it'be great if it works in linux and windows 7 as well.

I'm afraid that's beyond my control 😅 , the only thing we can do to ease web developers is to provide a polyfill (which I started and got somehow running for barcodes in this repo).

yell0wd0g commented 6 years ago

Actually I was playing around with the Mac implementation that should support a maximum amount of faces via the CIDetectorMaxFeatureCount (re. my comment above): on a closer examination this is only available for Rectangle Detectors (link).

kostadinnm commented 6 years ago

Actually, I just now realized that electron is quite behind chromium release-cycle. It currently utilizes chromium 59, while the face detection detect() method seems to actually be working(in a small demo of mine) in a far later version - the latest chrome 65. The problem is that even electron-beta is sub- chromium 63, if I remember correctly. I'm not much into how polyfills work, but I guess it's a wrapper that extends old frameworks with the newer apis, right?! If that is the case, I guess, there's some chance of having a polyfill for the face detection as well?! Otherwise, I'd have to use one of the aforementioned js libs, which is not how I imagined it :(

Edit: As a side note, I noticed a link on the readme page of the shape-detection-api is pointing to a wrong branch of js-objectdetect: 2018-03-12 20_30_44- Now it's target is https://github.com/mtschirs/js-objectdetect#performance, but I think it should be this: https://github.com/mtschirs/js-objectdetect/tree/master#performance I'm trying to learn github workflows - do you mind if I try fixing it?! I'll clone the repo tomorrow, but shouldn't I be in the contributors' list in order to create a pull request!?

Cheers, Kostadin