facial analysis timeit

This commit is contained in:
Sefik Ilkin Serengil 2020-04-21 12:23:44 +03:00 committed by GitHub
parent b7ba13f273
commit efc8221d32
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -53,12 +53,12 @@ deepface_result = DeepFace.verify("img1.jpg", "img2.jpg", model_name = "DeepFace
VGG-Face has the highest accuracy score but it is not convenient for real time studies because of its complex structure. FaceNet is a complex model as well. On the other hand, OpenFace has a close accuracy score but it performs the fastest. That's why, OpenFace is much more convenient for real time studies. VGG-Face has the highest accuracy score but it is not convenient for real time studies because of its complex structure. FaceNet is a complex model as well. On the other hand, OpenFace has a close accuracy score but it performs the fastest. That's why, OpenFace is much more convenient for real time studies.
The complexity of each face recognition model is different. Mean ± std. dev. of 7 runs for each model in my experiments is illustrated in the following table. The complexity of each face recognition model is different. Mean ± std. dev. of 7 runs on CPU for each model in my experiments is illustrated in the following table.
| Model | VGG-Face | OpenFace | Google FaceNet | Facebook DeepFace | | Model | VGG-Face | OpenFace | Google FaceNet | Facebook DeepFace |
| --- | --- | --- | --- | --- | | --- | --- | --- | --- | --- |
| Building | 2.35 s ± 46.9 ms | 6.37 s ± 1.28 s | 25.7 s ± 7.93 s | 23.9 s ± 2.52 s | | Building | 2.35 s ± 46.9 ms | 6.37 s ± 1.28 s | 25.7 s ± 7.93 s | 23.9 s ± 2.52 s |
| Verification | 897 ms ± 38.3 ms | 616 ms ± 12.1 ms | 684 ms ± 7.69 ms | 605 ms ± 13.2 ms | | Verification | 897 ms ± 38.3 ms | 616 ms ± 12.1 ms | 684 ms ± 7.69 ms | 605 ms ± 13.2 ms |
## Similarity ## Similarity
@ -88,6 +88,13 @@ print("Race: ", demography["dominant_race"])
<p align="center"><img src="https://raw.githubusercontent.com/serengil/deepface/master/icon/stock-2.jpg" width="95%" height="95%"></p> <p align="center"><img src="https://raw.githubusercontent.com/serengil/deepface/master/icon/stock-2.jpg" width="95%" height="95%"></p>
Model building and prediction times are different for those facial analysis models. Mean ± std. dev. of 7 runs on CPU for each model in my experiments is illustrated in the following table.
| Model | Emotion | Age | Gender | Race |
| --- | --- | --- | --- | --- |
| Building | 243 ms ± 15.2 ms | 2.25 s ± 34.9 | 2.25 s ± 90.9 ms | 2.23 s ± 68.6 ms |
| Prediction | 389 ms ± 11.4 ms | 524 ms ± 16.1 ms | 516 ms ± 10.8 ms | 493 ms ± 20.3 ms |
# Streaming and Real Time Analysis # Streaming and Real Time Analysis
You can run deepface for real time videos as well. Calling stream function under the DeepFace interface will access your webcam and apply both face recognition and facial attribute analysis. Stream function expects a database folder including face images. VGG-Face is the default face recognition model and cosine similarity is the default distance metric similar to verify function. The function starts to analyze if it can focus a face sequantially 5 frames. Then, it shows results 5 seconds. You can run deepface for real time videos as well. Calling stream function under the DeepFace interface will access your webcam and apply both face recognition and facial attribute analysis. Stream function expects a database folder including face images. VGG-Face is the default face recognition model and cosine similarity is the default distance metric similar to verify function. The function starts to analyze if it can focus a face sequantially 5 frames. Then, it shows results 5 seconds.