Comments (5)
What you can do is to increase the MinSize
to 50 or above to achieve a better frame rate, because this value defines the lower threshold above the face detector should be performed. I assume that the chances are very low that you need to analyze videos where the face sizes are smaller than 50px. Also if you already know the video size in advance you can adapt the MinSize
and MaxSize
accordingly. Another tip is to increase the ScaleFactor
with a few decimals, maybe around 1.3, 1.4. I've changed the MinSize
to 80 while testing and I got pretty decent latencies. There is no need to decrease the video frame rate, just adapt the cascade values.
Here are my settings:
cParams := pigo.CascadeParams{
MinSize: 80,
MaxSize: 1000,
ShiftFactor: 0.1,
ScaleFactor: 1.4,
ImageParams: pigo.ImageParams{
Pixels: pixels,
Rows: rows,
Cols: cols,
Dim: cols,
},
}
from pigo.
Direct him to your real time examples you did with web cam. They achieved good frame rate.
Secondly there is an optimisation you can make which I regularly do. You can assume the face in the next frame is approximately in same area.
So in frame 1, you detect the number of faces and area. Say 1 face was discovered in pos A.
In frame 2 you first crop the frame to pos A + 20%. You then look for faces in the sub frame.
If you find the face, move to frame 3. If not, search for faces in entire frame 2.
You can dramatically increase performance this way.
You also must use of all your CPU cores.
from pigo.
@pjebs that's sound like a really cool optimization approach, I haven't thought about it. Do you have some available examples about this approach?
from pigo.
@esimov thank you so much. After i set the min/max based on video res, the speed doubled/tripled. Thanks.
cols, rows := frame.Bounds().Max.X, frame.Bounds().Max.Y
cParams := pigo.CascadeParams{
MinSize: rows / 18,
MaxSize: rows,
ShiftFactor: 0.1,
ScaleFactor: 1.4,
ImageParams: pigo.ImageParams{
Pixels: pixels,
Rows: rows,
Cols: cols,
Dim: cols,
},
}
@pjebs That's so Giga Brain of you. But that optimisation to me at least, seems best used for 1 face detection in each frame and quite costly for the performance if the frame a bit crowded. But i'll try it anyway and see for myself. Thanks
from pigo.
This is exactly the same reason why I was curious about @pjebs suggestions, because cropping the image on each frame rate is quite costly, definitely more computation extensive than detecting the whole image, considering also that you have to deal with multiple faces. Maybe with one or two faces this approach is affordable giving a better performance boost.
from pigo.
Related Issues (20)
- oval shape HOT 15
- x / y values are backwards in json output HOT 1
- what is the mean of iouThreshold HOT 3
- is pigo.Pigo thread-safe? HOT 1
- Infinite loop HOT 11
- Comparison of two face HOT 16
- encountered some problems when i try write a demo by myself HOT 5
- Pigo Wasm demo crashes after certain time HOT 1
- What are the bounds of the score? HOT 2
- Invalid Face Detected HOT 2
- Can this be somehow used to smart-detect background image and replace it in realtime? HOT 3
- Adding jaw line facial landmarks HOT 2
- WASM Demo features toggled with keys fail HOT 2
- Is there a way to create new landmark point definitions? HOT 6
- Feature addition to support body recognition
- Got exit code 1073741819 (0xC0000005) from python demo HOT 7
- On the CLI, -flpc flag doesn't work without -plc. HOT 5
- CLI error in case of uppercase extensions
- [QUESTION] - How to run examples on local MacOS? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pigo.