-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path#Face_Encode.py
39 lines (27 loc) · 970 Bytes
/
#Face_Encode.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import face_recognition
import numpy as np
import pandas as pd
import os
from datetime import datetime
image_list_elektro = os.listdir("data - foto/")
print(image_list_elektro)
elektro_itk = []
for nama_saja in image_list_elektro:
a = nama_saja.split(".")[0]
# print(a)
elektro_itk.append(a)
df = pd.DataFrame(elektro_itk)
print(df)
df.to_csv("data/elektro-nomor", index=False, header=None)
waktu_mulai = datetime.now()
all_face_encodings= []
for image in image_list_elektro:
load_image = face_recognition.load_image_file(f"data - foto/{image}")
face_encode = face_recognition.face_encodings(load_image, num_jitters=10, )[0]
all_face_encodings.append(face_encode)
print(all_face_encodings)
np.savetxt("data/elektro_face_encodings.csv", all_face_encodings, delimiter=",")
print("\nEncoding All Faces Done...\n")
waktu_selesai = datetime.now()
total_waktu = waktu_selesai - waktu_mulai
print(total_waktu)