esimov / pigo Goto Github PK
View Code? Open in Web Editor NEWFast face detection, pupil/eyes localization and facial landmark points detection library in pure Go.
License: MIT License
Fast face detection, pupil/eyes localization and facial landmark points detection library in pure Go.
License: MIT License
Hello, I had a bug when I execute demo. It's nothing bad ;) .
github.com/esimov/pigo/examples/facedet # python2 demo.py
Traceback (most recent call last):
File "demo.py", line 66, in
cv2.circle(frame, (int(det[1]), int(det[0])), int(det[2]/2.0), (0, 0, 255), 2)
OverflowError: signed integer is greater than maximum
The demo documentation declares that there are supported keys:
s - Show/hide pupils
c - Circle through the detection shape types (rectangle
|circle
|ellipse
)
f - Show/hide facial landmark points (hidden by default)
On my local machine, the webcam streaming works and the fps is shown but the keys when pressed don't toggle the features mapped to them.
go version go1.17.2 linux/amd64
Browser: Firefox & Chrome
Hi there, is it possible to print/output the Facial Coordinates/Pupil Localization pointers in the JSON file with -json itself? Or any work around for the same?
or any other way to print the exact coordinates of the pupils or the other facial features?
This particular line is a possible (an in fact, experienced) infinite loop:
Line 246 in 0110acf
I've figured it out from the stack trace:
github.com/esimov/pigo/core.(*Pigo).classifyRegion(0xc0001a40a0, 0x42, 0x36, 0x9, 0xc00068e000, 0x238c, 0x238c, 0x5b, 0xbf800000)
The gorutine track trace parameters are as follows:
The issue comes from a rounding /casting error. The main readme (as well as my code) sets the cascade parameters scale factor as 1.1. When the scale is 9, the factor would come up with 9.9, which again becomes 9 because of the int() conversion.
The particular issue is that the source image was 91x100 (don't even ask), and I've calculated the face min/max size as 10% and 50% of the image width respectively. The minimum face size thus becomes 9 and with the scale ratio of 1.1 = infinite loop.
Possible fixes:
First off, just want to appreciate and thank you for this cool project you're working on.
I was wondering if you could add the feature to compare two faces and describe how likely they are.
A quick view of an example I found this happening per frame:
Lines 131 to 137 in 747334f
Why create the object and rerun that same unpack logic every time on the same source bytes. Should there be a Clone
on the Pigo
struct that just copies everything to a new struct to be better performing when running over and over?
can I share it between go routines?
Would it be possible to extend this library or use it as-is to perform facial recognition and thus identity of persons in images? (as opposed to face detection)
For some reason the x isn't really x but it's the y value, and vice versa. Weirdly they seem backwards in the json output.
I tested this by opening the image in photoshop and seeing where the x / y sits as compared to the values reported by pigo. They are accurate, just backwards. Unless I've clearly done something nooby 😕
Hi there! I'm trying to pass the values for the eyes separately using the blinkdet example, but seems like it outputs the values for both the eyes together and not separately (just outputting max_radius)
Is there a way to output the values that I get using -json via a particular variable or just output the values (max_radius) of both the eyes separately?
github.com/esimov/pigo/examples/delaunay
src/github.com/esimov/pigo/examples/delaunay/pigo.go:82:24: assignment mismatch: 4 variables but 3 values
src/github.com/esimov/pigo/examples/delaunay/pigo.go:82:35: cannot use subImg (type image.Image) as type io.Reader in argument to tri.Draw:
image.Image does not implement io.Reader (missing Read method)
src/github.com/esimov/pigo/examples/delaunay/pigo.go:82:35: cannot use false (type bool) as type io.Writer in argument to tri.Draw:
bool does not implement io.Writer (missing Write method)
I got the face detection working (thanks for your help in #12) but when I specify -json
, I see output.json getting created but empty.
./pigo -cf data/facefinder -in in.jpg -out out.png -angle=0.3 -json
my demo is : https://github.com/Taoja/web-wasm-faceDetector
This library is used in PhotoPrism: photoprism/photoprism#22 (comment)
PhotoPrism allows to define a threshold for the score.
While trying to document the value of that threshold, I wonder what are the possible values.
Define the minimal and maximal values for the score.
According to this article:
An image region is considered being face if the detection score average is above a certain threshold (in general around 0.995).
The score goes from 0 to 1?
.
I was wondering if this library can be used for detecting blinks.
You have a real-time example using python. Since chrome now supports (experimental) shape detection and video camera access: https://paul.kinlan.me/face-detection/ & https://medium.com/@joomiguelcunha/lets-play-with-chrome-s-face-detection-api-ca13017a958f
I was wondering if using your WASM port it was able to detect if a face was blinking.
I was wondering why func Unpack() (*Pigo, error)
needs to be a method of the struct Pigo
if that struct is never used inside the method. I think making Unpack()
a method of the package, instead of the struct, would have less overhead when initializing the classifier.
What do you think?
First, thanks for this, this is very much appreciated, and the code looks solid.
I have one small request, which I think is needed for this to be used as a library. And that is to replace the log.Fatal
(which does an ´os.Exit` I don't think is even possible to catch in a client):
https://github.com/esimov/pigo/blob/master/core/pigo.go#L67
I would suggest just returning an error. This may be "this should never happen errors", and then a panic may be in order.
Hi,
I'm starting to use the Pigo command, and while it's pretty good at detecting faces, its usage is a bit weird. Before that, I've tried some other applications like face_detection and facedetect.
Both can output the coordinates of the faces directly to the console (which is pretty useful to retrieve these infos from PHP).
But Pigo forces to create a PNG file (which is useless for what I want to do), and writes the JSON data to output.json in the current directory. If two calls are made in parallel, it could be a problem.
Would it be possible to:
Hi there,
I try to exec demo with Python 3.9 on Windows, sometimes got unexpected exit, with code -1073741819 (0xC0000005) , that err from C shared lib I think, and that because of index out of range usually.
I'm not good at Golang and not founded the true reason from code, give me some advice to fix it please, thx.
Can this be somehow used to smart-detect background image and replace it in realtime?
Would you be able to explain how you went and generated the facial landmark / density tree files that are used in the implementation of the Fast Localization of Facial Landmark Points? I would be keen to contribute, or ask if you can, the jaw line to the list of supported facial landmarks
Hi Endre (@esimov),
We would like to write a short piece about Pigo for our audience of developers and would like to do a Q&A with you. Article would be published on infoq.com. Last article on wasm was about a desktop game editor ported to WebAssembly. Let me know if that is of any interest to you.
Thanks for sharing this awesome project!
Is it possible to get bounding box coordinates outputted to the command line? I'd like to use pigo on my raspberry pi 3 to automatically crop images captured by the raspberry pi camera.
Also, would this work with people who are wearing glasses?
Many thanks!
cParams := pigo.CascadeParams{
MinSize: fd.minSize,
MaxSize: fd.maxSize,
ShiftFactor: fd.shiftFactor,
ScaleFactor: fd.scaleFactor,
ImageParams: pigo.ImageParams{
Pixels: pixels,
Rows: rows,
Cols: cols,
Dim: cols,
},
}
It never appears in README.md apart from these four lines.
In code I can see that DrawRectangles and Face Coordinates have the same input, but it turns out that the coordinates doesn't match face boxes. Is it a bug? Or I don't understand something?
https://github.com/blackjack/webcam can use this。
Tried in 2 systems and getting the JS errors . Logs attached
localhost-1584545562656.log
Hi,
Thanks for the great work here.
Is it possible to use pigo to extract faces from a photo and save the extracted faces individually.
-fplc
flag doesn't seem to work if -plc
isn't specified.
This command works fine:
$ pigo -in image.jpg -out output.jpg -cf ../pigo/cascade/facefinder -plc ../pigo/cascade/puploc -flpc ../pigo/cascade/lps
But running the following only detects the face but not its facial landmarks:
$ pigo -in image.jpg -out output.jpg -cf ../pigo/cascade/facefinder -flpc ../pigo/cascade/lps
-flpc
should work without -plc
as per the screenshot https://user-images.githubusercontent.com/883386/66802771-3b0cc880-ef26-11e9-9ee3-7e9e981ef3f7.png
Can this detect a face from a group of given a face to match with ?
Use case is video conferencing and Identification of a user for authentication
Webcam can be used from Go with GoCV. Resulting mat can then be encoded to jpg if needed.
First Tks for your nice project.
I am a bit confuse of the mean of iou parameter and it impact the result of the detection, and i use this lib for face detection, I'm wonder of how to set iouThreshold value correctly.
Hello, I got the WASM demo working and it's great. Is there a plan / easy way to enable all facial landmarks? I see some code is commented out. Thanks!
$> ./pigo -in input.jpg -out output.jpg -cf data/facefinder
Processing... -panic: runtime error: index out of range
goroutine 1 [running]:
github.com/esimov/pigo/core.(*Pigo).Unpack(0xc4206a8d50, 0xc420672000, 0x0, 0x200, 0x200, 0x0, 0x0)
/home/esimov/Projects/Go/src/github.com/esimov/pigo/core/pigo.go:66 +0xc5e
main.(*faceDetector).detectFaces(0xc4206a8f40, 0x7ffe8b90d545, 0x2d, 0x3, 0x3, 0x1, 0x50a920, 0xc42007e0c0)
/home/esimov/Projects/Go/src/github.com/esimov/pigo/cmd/pigo/main.go:164 +0x23b
main.main()
/home/esimov/Projects/Go/src/github.com/esimov/pigo/cmd/pigo/main.go:95 +0x296
pigo v1.1.0
What am I missing?
I use a stream of images and one of the tasks is to group faces, could you recommend a method for comparing faces.
I'm using pigo in my realtime app and observing many false detections. How can i reduce amount of them? Does pigo have some parameters to adjust?
Is it possible to use oval shape instead of square or circle?
I tried running pigo with various values for -angle and -scale but couldn't detect the face. Would appreciate any help!
there is two image with same person in it, can this library find and compare face from that two image ?, thankyou
# github.com/esimov/pigo/webcam
src/github.com/esimov/pigo/webcam/main.go:127:28: multiple-value pigo.Unpack() in single-value context
Found by smallrepo.
Build log: https://smallrepo.com/builds/20180607-063653-c1d35e4f
hard to compile python code.
can youwrite a go demo,not use python and go.
thanks
Hi. I'm trying to implement webcam based facial motion capture with with library.
The current set of face and retina landmarks is quite good, but I'm wondering if it's possible to extend the landmark regions that the PICO process can identify.
Specifically:
I'm assuming that new facial landmark locations would require defining new cascade files. Did the paper authors mentioned any recommendations on collecting and tagging example training data, or the training process itself?
Perhaps a simpler option would be to somehow define cascades for recognizing simple shapes like dot marks, or cross marks placed in an actor's face where the missing facial landmark points are needed.
Let me know if I missed anything.
Thanks!
Cannot fetch the cascade files on the Webassembly demo when the github server is down raw.githubusercontent.com
is down.
Hi,
If I run your web example than I get this error:
2020/04/24 21:51:38 [ERROR] reading next part multipart: NextPart: EOF
I must admit that I don't meet the requirements for this example. My python is python3 and my opencv is 4.2. OS is Ubuntu 20.04LTS.
I tested as follows
Hey,
I was trying to run facefinder on this particular image
https://user-images.githubusercontent.com/88735/81735832-f0d8cf00-9495-11ea-909c-2bd1dd65394b.png
and I am unable to detect any faces. Can you help me why it's the case?
Actually I saw this pattern for different faces which are quite close such as couples.
Command I used
./pigo --in couple6.png -out out.png -pl -cf cascade/facefinder
I just took the defaults
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.