Comments (3)
Hi @ivsanro1
Hmm... That's new fresh idea.
But, you might face some issues because it is required to modify dlib's overall architecture.
In app/src/main/.../OnGetImageListener.java, there is a code like below.
results = mFaceDet.detect(mResizedBitmap);
This method contains detection, feature extraction. Now, it doesn't divided atomically.
Here is the source code of current engine. dlib
I only modified some points that can be parallel-processing.
Please check the source code if separation is possible.
Thank you for your suggestion :)
from fast-face-android.
I know, I know, but I don't think it is really about dlib. Let me explain:
As far as I know, dlib is attached to the project via shared library that also includes the compiled JNI libraries that help to comunicate the C++ code (dlib) with the java code (the app). In this project, the first call from the Java code related to the face detection is, like you said, in app/src/main/.../OnGetImageListener.java:
results = mFaceDet.detect(mResizedBitmap);
where results
is an instance object from the class FaceDet
, and, as you said, detect(ยท)
is a method from that class which performs the face detection and the landmark calculation atomically.
I have seen in the dlib-android project the source files of the JNI, and I guess they are unchanged in this project, those can be found here:
https://github.com/tzutalin/dlib-android/tree/master/jni/jni_detections
and specifically, jni_face_det.cpp has the source code of the native methods that grab the code directly from dlib. This is the part that I don't understand too much, but you get the main idea: the detection and the landmark is calculated atomically (you can't calculate such things separatedly).
However, if we take a look at the dlib example face_landmark_detection_ex.cpp
, that can be found in:
http://dlib.net/face_landmark_detection_ex.cpp.html
you can see that the face detector:
frontal_face_detector detector = get_frontal_face_detector();
and the landmark calculator, known as shape predictor:
shape_predictor sp; deserialize(argv[1]) >> sp;
are two separated things, and, in fact, the face detection task:
std::vector<rectangle> dets = detector(img);
and the landmark extraction task:
full_object_detection shape = sp(img, dets[j])
are being done separatedly. Therefore, despite I don't really know how to separate such code when it comes to the JNI libraries, I think that could be possible (and, in fact, it would be the best pratice) to do a JNI native method for the face detection only and another one for the landmark extractor, but separatedly. But I have a lot of problems understanding how could I achieve this, because I have no idea of JNI and I find JNI code very awful.
Thanks for your time
from fast-face-android.
@ivsanro1 Yes, Originally, Dlib process steps as you mentioned. frontal_face_detect --> feature extraction.
But, I can't fully understand your suggestion. Is this the main idea that you said?
Reduce the frequency of face-detection(per 6 frames), keep extracting feature(per 2 frames).
ex) one cycle
frame 1 Face detection, feature extraction
frame 2 -
frame 3 Feature extraction
frame 4 -
frame 5 Feature extraction
I completely know this idea can boost the speed temporarily.
But, fundamental problem of this app is detecting every N frames. N-1 frames occurs false positive.
I think changing internal algorithm has a limit. So, I'm working hard to boost the speed using external resources (GPU, FPU core, Deep learning based modeling)
Anyway, Thank you so much for your interest.
When I upgrade the app, I'll let you know first.
from fast-face-android.
Related Issues (20)
- face recognition HOT 3
- Optimize the jni native code HOT 4
- Why MainActivity_ ? HOT 1
- Contents Above 150 MB HOT 1
- Where is the revised jni_face_det file along with the detector header?
- What resolution image does the 50-70 ms time estimate apply to? HOT 1
- How to select only lip's landmarks HOT 6
- How did you optimize dlib? HOT 2
- Caused by: org.gradle.tooling.BuildException: invalid code lengths set
- Can this APP realize the function of face expression recognition HOT 1
- IOS version HOT 1
- Getting crashed when sending first frame of camera in some devices
- gradle 7.0
- why my camera phone didn't showing?? HOT 7
- how can I change the min face size that the detector detects HOT 1
- front camera HOT 2
- What are the methods behind your Fast-Face? HOT 3
- How can I detect the middle of the forehead? HOT 1
- Get NDK path with this approach.
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 fast-face-android.