update

swadhinbiswas committed 2 years ago
97c0bde
1 parent c59a6c2
commit 97c0bde
20 files changed
+91 -18
▼README.md
+38-0
40
40
### Login Page
41
41
![LoginPage](photos/loginpage.gif)
42
42
43
+
44
+
45
+
46
+
47
+### BackEnd
48
+
49
+- ### Face recognition
50
+- ### Anti-Spoofing
51
+- ### FastAPI
52
+- ### Firebase[As realtime Database]
53
+
54
+## Backend Stracture
55
+![ImageBackend](photos/faceaoo.jpeg)
56
+
57
+## working process of Face recognition
58
+
59
+### [How the Face Recognition Work using deeplearning ](https://medium.com/@ageitgey/machine-learning-is-fun-part-4-modern-face-recognition-with-deep-learning-c3cffc121d78)
60
+![faceapp](photos/faceapp.gif)
61
+
62
+
63
+## Antispoofing
64
+
65
+### [How to antispoofing work ](https://github.com/minivision-ai/Silent-Face-Anti-Spoofing)
66
+
67
+![Anti spoofing](photos/85498505-6ff1-4110-b67c-bac030223467.jpeg)
68
+
69
+### example:
70
+![example](photos/-video-to-gif-converter.gif)
71
+
72
+
73
+
74
+
75
+# Work Flow
76
+
77
+ ✅ EncodeFace ✅ Database Connection ✅ Upload encode Picture to Database ✅Setup plugins ✅Fontend ✅ Building API ✅ Authentication ✅ RealtimeDatabase Sync ❌ Connect Backend With Fontend ❌ Deploy App
78
+
79
+
80
+
43
81
▼backend/app/admin/handelars.py
+0-3
83
83
file.close()
84
84
85
85
86
-
87
-
88
-
89
86
90
87
91
88
▼backend/app/admin/pathtest.py
+0-2
1
-import os
2
-
3
0
▼backend/app/functions/encodeGenarator.py
+1-11
6
6
from app.settings.connectdb import Firebase
7
7
8
8
9
-
10
-
11
-
12
-
13
-
14
9
class EndcodeGenarator:
15
10
def __init__(self):
16
11
self.known_face_encodings = []
23
18
self.bucket = Firebase().bucket
24
19
self.idsref = Firebase().idsref
25
20
26
- async def findencoding(self):
21
+ def findencoding(self):
27
22
imageList=self.pathlist
28
23
for img in imageList:
29
- bucket=self.bucket
30
24
ref=self.ref
31
- if not bucket.get_blob(f"faceappimage/{img}"):
32
- with open(f"{self.imagepath}/{img}","rb") as file:
33
- bucket.blob(f"faceappimage/{img}").upload_from_file(file)
34
25
id=img.split(".")[0]
35
26
self.studentids.append(id)
36
27
if not ref.child(id).get():
37
- if img.endswith(".jpg") or img.endswith(".png") or img.endswith(".jpeg"):
38
28
cv2img=cv2.imread(f"{self.imagepath}/{img}")
39
29
img=cv2.cvtColor(cv2img,cv2.COLOR_BGR2RGB)
40
30
encode=face_recognition.face_encodings(img)[0]
41
31
▼backend/app/functions/face.py
+12-2
5
5
6
6
7
7
from face_recognition import face_locations, face_encodings, compare_faces, face_distance
8
-class Face:
8
+class Face():
9
9
def __init__(self,frame):
10
10
self.frame=frame
11
11
self.ids=[]
43
43
cv2.putText(frame,"Unknown",(x1+6,y2-6),cv2.FONT_HERSHEY_COMPLEX,1,(255,255,255),2)
44
44
45
45
return frame
46
-
46
+ def get_student_id(self):
47
+ return self.ids
48
+
49
+
50
+# class Ids(Face):
51
+# def __init__(self):
52
+# super().__init__(frame)
53
+# self.ids=[]
54
+
55
+# def getstudentid(self):
56
+# return self.ids
47
57
48
58
49
59
50
60
▼backend/app/functions/getfacefromdata
+0-0
0
0
▼backend/app/functions/getfacefromdatabase.py
+18-0
1
+from app.settings.connectdb import Firebase
2
+# from app.functions.face import Ids
3
+
4
+
5
+
6
+class GetgaceandData:
7
+ def __init__(self):
8
+ self.ref=Firebase().ref
9
+ # self.id=Ids().id
10
+ self.idsref=Firebase().idsref
11
+ self.bucket=Firebase().bucket
12
+ def get_data_by_key(self):
13
+ return self.ref.child(self.id).get()
14
+ def get_picture(self):
15
+ return self.bucket.get_blob(f"faceappimage/{self.id}")
16
+
17
+ def get_data_by_child(self):
18
+ return self.ref.order_by_child("status").equal_to("Present").get()
0
19
▼backend/app/functions/pictures/222156097.jpg
+0-0
Binary file not shown.
▼backend/app/functions/pictures/222156097.png
+0-0
Binary file not shown.
▼backend/app/functions/pictures/222156116.jpg
+0-0
Binary file not shown.
▼backend/app/functions/pictures/222156116.png
+0-0
Binary file not shown.
▼backend/app/functions/pictures/222156259.jpeg
+0-0
Binary file not shown.
▼backend/app/functions/pictures/222156288.jpeg
+0-0
Binary file not shown.
▼backend/app/functions/pictures/222156288.png
+0-0
Binary file not shown.
▼backend/app/functions/videoapp.py
+22-0
5
5
from app.functions.face import Face
6
6
import streamlit as st
7
7
from app.functions.encodeGenarator import EndcodeGenarator
8
+from app.functions.getfacefromdatabase import GetgaceandData
8
9
# from app.settings import setting
9
10
# camip=setting.CAM_IP
10
11
camip="192.168.0.103"
26
27
success, img = cap.read()
27
28
x=Face(img)
28
29
frame=x.facedefine()
30
+ y=x.get_student_id()
29
31
if not success:
30
32
break
31
33
ret, buffer = cv2.imencode('.jpg', frame)
33
35
frame = buffer.tobytes()
34
36
yield (b'--frame\r\n'
35
37
b'Content-Type: image/jpeg\r\n\r\n' + frame + b'\r\n')
38
+
39
+ return y
40
+
36
41
37
42
38
43
52
57
def video():
53
58
return st.markdown(f'<iframe width="560" height="315" src="http://{camip}:3030/video" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>', unsafe_allow_html=True)
54
59
60
+@videorouter.get("/genarateface")
61
+def genarateface():
62
+ x=EndcodeGenarator()
63
+ y= x.findencoding()
64
+ return y
65
+
66
+@videorouter.get("/getstudentsphotos")
67
+async def getstudentsphotos():
68
+ x=GetgaceandData().get_picture()
69
+ return x
70
+
71
+@videorouter.get("/getstudentsdata")
72
+async def getstudentsdata():
73
+ x=GetgaceandData().get_data_by_key()
74
+ return x
75
+
55
76
77
+
56
78
▼photos/-video-to-gif-converter.gif
+0-0
Binary file not shown.
▼photos/7e0564ae-d663-4e04-846e-f30670b649e2.jpeg
+0-0
Binary file not shown.
▼photos/85498505-6ff1-4110-b67c-bac030223467.jpeg
+0-0
Binary file not shown.
▼photos/faceaoo.jpeg
+0-0
Binary file not shown.
▼photos/faceapp.gif
+0-0
Binary file not shown.