mirror of
https://github.com/serengil/deepface.git
synced 2025-06-07 12:05:22 +00:00
clean code
This commit is contained in:
parent
1882e169bb
commit
920ab02b19
10
README.md
10
README.md
@ -25,7 +25,6 @@ Verification function under the DeepFace interface offers a single face recognit
|
|||||||
```python
|
```python
|
||||||
from deepface import DeepFace
|
from deepface import DeepFace
|
||||||
result = DeepFace.verify("img1.jpg", "img2.jpg")
|
result = DeepFace.verify("img1.jpg", "img2.jpg")
|
||||||
|
|
||||||
print("Is verified: ", result["verified"])
|
print("Is verified: ", result["verified"])
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -50,10 +49,7 @@ You can apply face recognition on a [large scale](https://sefiks.com/2020/05/25/
|
|||||||
```python
|
```python
|
||||||
from deepface import DeepFace
|
from deepface import DeepFace
|
||||||
import pandas as pd
|
import pandas as pd
|
||||||
|
|
||||||
df = DeepFace.find(img_path = "img1.jpg", db_path = "C:/workspace/my_db")
|
df = DeepFace.find(img_path = "img1.jpg", db_path = "C:/workspace/my_db")
|
||||||
print(df.head())
|
|
||||||
|
|
||||||
#dfs = DeepFace.find(img_path = ["img1.jpg", "img2.jpg"], db_path = "C:/workspace/my_db")
|
#dfs = DeepFace.find(img_path = ["img1.jpg", "img2.jpg"], db_path = "C:/workspace/my_db")
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -111,10 +107,8 @@ Deepface also offers facial attribute analysis including [`age`](https://sefiks.
|
|||||||
|
|
||||||
```python
|
```python
|
||||||
from deepface import DeepFace
|
from deepface import DeepFace
|
||||||
demography = DeepFace.analyze("img4.jpg") #passing nothing as 2nd argument will find everything
|
demography = DeepFace.analyze("img4.jpg", actions = ['age', 'gender', 'race', 'emotion'])
|
||||||
#demography = DeepFace.analyze("img4.jpg", ['age', 'gender', 'race', 'emotion']) #identical to the line above
|
|
||||||
#demographies = DeepFace.analyze(["img1.jpg", "img2.jpg", "img3.jpg"]) #analyzing multiple faces same time
|
#demographies = DeepFace.analyze(["img1.jpg", "img2.jpg", "img3.jpg"]) #analyzing multiple faces same time
|
||||||
|
|
||||||
print("Age: ", demography["age"])
|
print("Age: ", demography["age"])
|
||||||
print("Gender: ", demography["gender"])
|
print("Gender: ", demography["gender"])
|
||||||
print("Emotion: ", demography["dominant_emotion"])
|
print("Emotion: ", demography["dominant_emotion"])
|
||||||
@ -137,13 +131,11 @@ You can build facial attribute analysis models once and pass these to analyze fu
|
|||||||
```python
|
```python
|
||||||
import json
|
import json
|
||||||
from deepface.extendedmodels import Age, Gender, Race, Emotion
|
from deepface.extendedmodels import Age, Gender, Race, Emotion
|
||||||
|
|
||||||
models = {}
|
models = {}
|
||||||
models["emotion"] = Emotion.loadModel()
|
models["emotion"] = Emotion.loadModel()
|
||||||
models["age"] = Age.loadModel()
|
models["age"] = Age.loadModel()
|
||||||
models["gender"] = Gender.loadModel()
|
models["gender"] = Gender.loadModel()
|
||||||
models["race"] = Race.loadModel()
|
models["race"] = Race.loadModel()
|
||||||
|
|
||||||
DeepFace.analyze("img1.jpg", models=models)
|
DeepFace.analyze("img1.jpg", models=models)
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user