Toggle navigation
Toggle navigation
This project
Loading...
Sign in
2020-2-capstone-design2
/
2014104149
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
Graduate
2020-12-10 10:44:53 +0000
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
3a3dd34abe0a4e342bbdd6037619cbbef937863e
3a3dd34a
1 parent
490fa4c6
Add image standardization
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
10 additions
and
6 deletions
flask/app.py
flask/config.cnf
flask/run.sh
flask/templates/register.html
flask/app.py
View file @
3a3dd34
...
...
@@ -28,6 +28,9 @@ app = Flask(__name__)
sess
=
tf
.
compat
.
v1
.
Session
()
def
image_standardization
(
image
):
return
(
image
-
127.5
)
/
128.0
def
resize
(
image
):
resized
=
cv2
.
resize
(
image
,
(
image_size
,
image_size
),
interpolation
=
cv2
.
INTER_AREA
)
return
resized
...
...
@@ -80,6 +83,7 @@ def register():
image_np
=
np
.
frombuffer
(
image
,
dtype
=
np
.
uint8
)
image_np
=
cv2
.
imdecode
(
image_np
,
cv2
.
IMREAD_UNCHANGED
)
image_np
=
cv2
.
cvtColor
(
image_np
,
cv2
.
COLOR_BGR2RGB
)
image_np
=
image_standardization
(
image_np
)
image_np
=
prewhiten
(
image_np
)
image_np
=
resize
(
image_np
)
image_np
=
image_np
.
reshape
(
-
1
,
image_size
,
image_size
,
3
)
...
...
@@ -127,7 +131,7 @@ def verify():
if
(
distance
<
dist_min
):
verified_id
=
row_data
[
'student_id'
]
dist_min
=
distance
new_embedding
=
db_embedding
*
0.9
7
+
embedding
*
0.03
new_embedding
=
db_embedding
*
0.9
9
+
embedding
*
0.01
new_embedding
=
new_embedding
.
tobytes
()
sql
=
"UPDATE student_embedding SET embedding=_binary
%
s WHERE student_id =
%
s"
cursor
.
execute
(
sql
,
(
new_embedding
,
verified_id
))
...
...
flask/config.cnf
View file @
3a3dd34
[verification_server]
model=models/20200816-080621
threshold=0.
78
threshold=0.
685
image_size=160
...
...
flask/run.sh
View file @
3a3dd34
python3 -m flask run --host 0.0.0.0 --port 443 --cert
=
cert.pem --key
=
key.pem
python3 -m flask run --host 0.0.0.0 --port 443 --
no-debugger --no-reload --
cert
=
cert.pem --key
=
key.pem
...
...
flask/templates/register.html
View file @
3a3dd34
...
...
@@ -257,13 +257,13 @@ and is wrapped around the whole page content, except for the footer in this exam
<canvas
id=
"canvasOutput"
>
/canvas>
</div>
<div
id=
"inputForm"
>
<strong>
얼굴 이미지는 서버에 저장되지 않습니다
</strong><br>
<strong>
(복원 불가능한 512차원 벡터로 변환됩니다)
</strong><br>
<strong>
얼굴 이미지는 '절대로' 저장되지 않습니다
</strong><br>
<strong>
학번과 이름은 임의로 입력해주세요
</strong><br>
<strong>
예)1234/홍길동 등
</strong><br>
학번:
<input
type=
"text"
id=
"student_id"
><br>
이름:
<input
type=
"text"
id=
"student_name"
><br>
<input
id=
"sender"
type=
"button"
onclick=
"submit()"
value=
"등록"
disabled
>
<input
id=
"sender"
type=
"button"
onclick=
"submit()"
value=
"등록"
disabled
><br>
등록 후:
<a
href=
"https://gabibing.com"
>
출석체크 페이지
</a>
</div>
</div>
</div>
...
...
Please
register
or
login
to post a comment