Toggle navigation
Toggle navigation
This project
Loading...
Sign in
2020-1-capstone-design1
/
KHY_Project1
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Graphs
Network
Create a new issue
Commits
Issue Boards
Authored by
Graduate
2020-06-04 21:59:02 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
7a091afdd982a406cf8d8fc90a17bab676abbc9c
7a091afd
1 parent
5e065950
Modify client.py
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
25 deletions
client/clinet(window).py
client/clinet(window).py
View file @
7a091af
...
...
@@ -24,29 +24,24 @@ print('Running on device: {}'.format(device))
mtcnn
=
MTCNN
(
keep_all
=
True
,
device
=
device
)
uri
=
'ws://
169.56.95.131
:8765'
uri
=
'ws://
localhost
:8765'
async
def
send_face
(
face_list
):
async
def
send_face
(
face_list
,
image_list
):
global
uri
async
with
websockets
.
connect
(
uri
)
as
websocket
:
for
face
in
face_list
:
for
face
,
image
in
zip
(
face_list
,
image_list
)
:
#type: np.float32
print
(
face
.
shape
)
data
=
json
.
dumps
({
"action"
:
"verify"
,
"MTCNN"
:
face
.
tolist
()})
await
websocket
.
send
(
data
)
print
(
'send: verify'
,
len
(
face_list
),
'face(s)'
)
code
=
await
websocket
.
recv
()
print
(
'code:'
,
code
)
async
def
send_image
(
image_list
):
global
uri
async
with
websockets
.
connect
(
uri
)
as
websocket
:
for
image
in
image_list
:
data
=
json
.
dumps
({
"action"
:
"save_image"
,
"image"
:
image
.
tolist
(),
"shape"
:
image
.
shape
})
await
websocket
.
send
(
data
)
print
(
'send'
,
len
(
image_list
),
'image(s)'
)
code
=
await
websocket
.
recv
()
print
(
'code:'
,
code
)
send
=
json
.
dumps
({
"action"
:
"verify"
,
"MTCNN"
:
face
.
tolist
()})
await
websocket
.
send
(
send
)
recv
=
await
websocket
.
recv
()
data
=
json
.
loads
(
recv
)
if
data
[
'status'
]
==
'success'
:
# 성공
print
(
data
[
'student_id'
],
'is attend'
)
else
:
print
(
'verification failed'
)
send
=
json
.
dumps
({
'action'
:
'save_image'
,
'image'
:
image
.
tolist
()})
await
websocket
.
send
(
send
)
def
detect_face
(
frame
):
# If required, create a face detection pipeline using MTCNN:
...
...
@@ -89,12 +84,7 @@ while True:
image_list
=
detect_face
(
frame
)
##embedding server로 전송##
if
face_list
:
asyncio
.
get_event_loop
()
.
run_until_complete
(
send_face
(
face_list
))
###################
##image server로 전송##
if
image_list
:
asyncio
.
get_event_loop
()
.
run_until_complete
(
send_image
(
image_list
))
###################
asyncio
.
get_event_loop
()
.
run_until_complete
(
send_face
(
face_list
,
image_list
))
#end = timeit.default_timer()
#print('delta time: ', end - start)
except
Exception
as
ex
:
...
...
Please
register
or
login
to post a comment