Spaces:
Running
Running
switching to yolo8
Browse files- .deepface/weights/yolov8n-face.pt +3 -0
- .gitattributes +1 -0
- app.py +2 -19
- face.db +2 -2
- face.json +2 -2
- persons.zip +1 -1
- requirements.txt +3 -2
.deepface/weights/yolov8n-face.pt
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:d545bf1add5aa736a4febac4f4f9245a6d596cd0fe70d5d57989fe0cb9e626ca
|
3 |
+
size 6389512
|
.gitattributes
CHANGED
@@ -33,3 +33,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
33 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
34 |
*.db filter=lfs diff=lfs merge=lfs -text
|
35 |
face.json filter=lfs diff=lfs merge=lfs -text
|
|
|
|
33 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
34 |
*.db filter=lfs diff=lfs merge=lfs -text
|
35 |
face.json filter=lfs diff=lfs merge=lfs -text
|
36 |
+
.deepface/weights/yolov8n-face.pt filter=lfs diff=lfs merge=lfs -text
|
app.py
CHANGED
@@ -8,15 +8,9 @@ import pyzipper
|
|
8 |
import numpy as np
|
9 |
import gradio as gr
|
10 |
from annoy import AnnoyIndex
|
11 |
-
from deepface
|
12 |
-
from deepface.basemodels import Facenet512
|
13 |
|
14 |
|
15 |
-
# load the face model
|
16 |
-
model = Facenet512.loadModel()
|
17 |
-
|
18 |
-
input_shape_x, input_shape_y = functions.find_input_shape(model)
|
19 |
-
|
20 |
index = AnnoyIndex(512, "euclidean")
|
21 |
index.load(f"face.db")
|
22 |
|
@@ -27,7 +21,6 @@ with pyzipper.AESZipFile('persons.zip') as zf:
|
|
27 |
zf.setpassword(password)
|
28 |
PERFORMER_DB = json.loads(zf.read('performers.json'))
|
29 |
|
30 |
-
|
31 |
## Prediction functions
|
32 |
|
33 |
|
@@ -42,17 +35,7 @@ def image_search_performer(image, threshold=20.0, results=3):
|
|
42 |
"""
|
43 |
|
44 |
image_array = np.array(image)
|
45 |
-
|
46 |
-
img = functions.preprocess_face(
|
47 |
-
img=image_array,
|
48 |
-
target_size=(input_shape_x, input_shape_y),
|
49 |
-
enforce_detection=True,
|
50 |
-
detector_backend="retinaface",
|
51 |
-
align=True,
|
52 |
-
)
|
53 |
-
|
54 |
-
img = functions.normalize_input(img, normalization="Facenet2018")
|
55 |
-
face = model.predict(img)[0]
|
56 |
return search_performer(face, threshold, results)
|
57 |
|
58 |
|
|
|
8 |
import numpy as np
|
9 |
import gradio as gr
|
10 |
from annoy import AnnoyIndex
|
11 |
+
from deepface import DeepFace
|
|
|
12 |
|
13 |
|
|
|
|
|
|
|
|
|
|
|
14 |
index = AnnoyIndex(512, "euclidean")
|
15 |
index.load(f"face.db")
|
16 |
|
|
|
21 |
zf.setpassword(password)
|
22 |
PERFORMER_DB = json.loads(zf.read('performers.json'))
|
23 |
|
|
|
24 |
## Prediction functions
|
25 |
|
26 |
|
|
|
35 |
"""
|
36 |
|
37 |
image_array = np.array(image)
|
38 |
+
face = DeepFace.represent(img_path = image_array, detector_backend='yolov8', model_name='Facenet512')[0]['embedding']
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
39 |
return search_performer(face, threshold, results)
|
40 |
|
41 |
|
face.db
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
-
size
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:7ab68d919e7a875bcfdf5ab4e4d60d76cbd744cdba8ab255274f28d578be5483
|
3 |
+
size 612925440
|
face.json
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
-
size
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:30606fb842f9ebdb2a1018dab31b949b7f785b45ce30a7625e724aa267c03d34
|
3 |
+
size 7679120
|
persons.zip
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
size 3705286
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:adf87972c704d73affed311b663d24f5fc790d3f06b35ae9c734d0babd06d212
|
3 |
size 3705286
|
requirements.txt
CHANGED
@@ -15,7 +15,8 @@ charset-normalizer==3.1.0
|
|
15 |
click==8.1.3
|
16 |
contourpy==1.0.7
|
17 |
cycler==0.11.0
|
18 |
-
deepface
|
|
|
19 |
entrypoints==0.4
|
20 |
fastapi==0.95.0
|
21 |
ffmpy==0.3.0
|
@@ -53,7 +54,7 @@ mdit-py-plugins==0.3.3
|
|
53 |
mdurl==0.1.2
|
54 |
mtcnn==0.1.1
|
55 |
multidict==6.0.4
|
56 |
-
numpy
|
57 |
oauthlib==3.2.2
|
58 |
opencv-python==4.7.0.72
|
59 |
opt-einsum==3.3.0
|
|
|
15 |
click==8.1.3
|
16 |
contourpy==1.0.7
|
17 |
cycler==0.11.0
|
18 |
+
git+https://github.com/serengil/deepface.git#f13aa34feb17ccd539eb67b671a42d7160d59298
|
19 |
+
ultralytics==8.0.175
|
20 |
entrypoints==0.4
|
21 |
fastapi==0.95.0
|
22 |
ffmpy==0.3.0
|
|
|
54 |
mdurl==0.1.2
|
55 |
mtcnn==0.1.1
|
56 |
multidict==6.0.4
|
57 |
+
numpy
|
58 |
oauthlib==3.2.2
|
59 |
opencv-python==4.7.0.72
|
60 |
opt-einsum==3.3.0
|