7 ms·
Pico.js – A face-detection library in 200 lines of JavaScript (2018)
- geenat 4y agoWould be great to have something like this for filtering adult content from uploads.
- fundamental 4y agoFYI in case you didn't already know this, filtering adult content is a massively more challenging problem than face detection.
- hbn 4y agoAnd the philosophical aspect of what "adult content" is more difficult than the implementation
- robertlagrant 4y agoI thought they solved this on that Silicon Valley documentary?
- deleted 4y ago[deleted]
- classified 4y ago"I'll know it whe I see it."
- no-1ne 4y agocan this help https://github.com/infinitered/nsfwjs https://github.com/infinitered/nsfwjs
- tinus_hn 4y agoIt’s not very useful to implement a filter on the client, you have to filter somewhere where you have control, i.e. on the server.
- deleted 4y ago[deleted]
- stjohnswarts 4y agoI'm kind of surprised that the big guys who do image detection (like google) won't open source whatever algos they use to separate "moderate" content from "adult" content on their image search. It's not 100% but works pretty well in my experience.
- doytch 4y agoI'm not saying it's correct, but my first thought would be that it would make it much easier for bad actors to come up with ways of getting around the algorithm.
- stjohnswarts 4y agothat's a good point and I didn't think about that.
- amenghra 4y agoMight not be the answer you are looking for, but there are several companies offering APIs to filter content. E.g. Microsoft has a Vision API. Per https://azure.microsoft.com/en-us/pricing/details/cognitive-services/computer-vision/ https://azure.microsoft.com/en-us/pricing/details/cognitive-..., it's $1 per 1000 requests (with the first 5000 being free). They also have PhotoDNA, which is free but does a subset of SFW. PixLab is another option (https://pixlab.io/cmdls https://pixlab.io/cmdls). Google has an API too (Cloud Vision). If you go down this path, you'll have to do your own research on which service works best and what you can afford.
- pstuart 4y agoNot hotdog comes to mind: https://www.youtube.com/watch?v=ACmydtFDTGs https://www.youtube.com/watch?v=ACmydtFDTGs
- yboris 4y agoFor those looking to not only detect, but also vectorize faces (for later comparison against other faces) -- face recognition, try out: face-api.js https://github.com/justadudewhohacks/face-api.js/ https://github.com/justadudewhohacks/face-api.js/
- royal_ts 4y agoit's a cool library, I've used it in my bachelor's thesis applied to a camera stream
- PointyFluff 4y agoA face-detection library interface library in 200 lines of JS FTFY
- xrd 4y agoDuring the protests two years ago, I built this little app that you can use to obscure faces when sharing pictures. It uses face-api-js as others have mentioned. https://github.com/xrd/faceoff https://github.com/xrd/faceoff
- charcircuit 4y agoWhy didn't you cherry pick an image where it covered everyone's face? The example has several people not obscured or have the dot not fully covering their face.
- xrd 4y agoMeaning the two pictures in the readme? The first is an image from Wikipedia, and the second is my face. If there is another image that is concerning, please let me know and I'll remove it and clean the history. I built this because I am uncomfortable sharing images of others without their consent (as happens all the time on social media) and also sharing my own childrens' faces, because I completely distrust the social media companies in particular.
- deleted 4y ago[deleted]
- hackernudes 4y agoI think the commenter meant why did you choose to show a non-perfect example of your software working? It missed a few faces in the black and white picture.
- Nzen 4y agoI'd like to understand the motivation behind your question. Complaining about the unobscured faces would start the conversation about training data and its diminished inclusivity. But, your comment focused on the perception a person looking at the result might have, given the incomplete feature set of this software. I am having trouble imagining the sort of visitor xrd would disappoint with the imperfect image, that he should want to have retained, that wouldn't complain when noticing the gap him or herself during testing. Could you please elaborate ?
- AkshatJ27 4y agoFrom the demo[0], It seems to do really well, until you turn your head even just a tiny bit. At which point it stops detecting. [0]: https://nenadmarkus.com/p/picojs-intro/demo/ https://nenadmarkus.com/p/picojs-intro/demo/
- charcircuit 4y ago200 LOC is misleading since it requires you to download a model separately to use it.
- sbf501 4y agoHere are the models it downloads (in webcam.html) var cascadeurl = 'https://raw.githubusercontent.com/nenadmarkus/pico/c2e81f9d23cc11d1a612fd21e4f9de0921a5d0d9/rnt/cascades/facefinder'; var puplocurl = 'https://drone.nenadmarkus.com/data/blog-stuff/puploc.bin' The former is 234 KB, the latter is 1.4 MB
- elteto 4y agoIs the model code? Or just data? Because if it’s just data and the library truly only needs 200 LOC to work with that model then it’s fair to say that it is a 200 LOC only library. I can write a naive spell checker in a few dozen lines of Python, say 100 lines. I’ll need a dictionary file for it to be useful though. Would you claim my code is 100 lines or 50100 (assuming dict file has 50k words) lines?
- userbinator 4y agoThe latter, because in this case the bulk of the "what is a face" function is determined by that data.
- liuliu 4y agoHAAR Cascading based face detectors are subpar to neural-network based ones. It is better to just use TF.js and related face detector. These are faster and much more accurate. (I wrote JS-based face detector a decade ago: https://liuliu.me/eyes/javascript-face-detection-explained/ https://liuliu.me/eyes/javascript-face-detection-explained/)
- rsrsrs86 4y agoWhile reading the post, it didn’t strike me as odd. I worked with small services wrapping ML models and 200 lines looks very slick and I don’t recall anyone considering weights as part of the code, and even the model training code is treated differently that the cliente code. Seems legit
- alana314 4y agoI used this on a raspberry pi for this kinetic sculpture: https://www.youtube.com/watch?v=6xAiKI6XswM https://www.youtube.com/watch?v=6xAiKI6XswM I was thankful that it worked on a variety of diverse faces, even masked somewhat.
- moffkalast 4y agoThat's pretty neat, how does it look like from the viewer's perspective? Also what's the mechanism behind the turning? If I counted this right it would have to be like 48 servos which sounds expensive, but also is an interesting number because that's exactly 3 of those PCA 16 channel servo expansion boards...
- dtgriscom 4y agoYou can get hobby R/C servos for $2.50 each these days. So, $120, plus the interface board(s).
- Minor49er 4y agoThat is really cool. I hope you make a post about your work on Hacker News!