Toggle navigation
Toggle navigation
This project
Loading...
Sign in
2020-2-capstone-design2
/
2015102747
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
이재빈
2020-10-08 08:08:25 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
37d8c826e259b38d77d1c90c1297065b941a735f
37d8c826
1 parent
ad221f9b
Core Cloud 수신모듈 작성
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
6 deletions
Modules/core_cloud.py
Modules/core_cloud.py
View file @
37d8c82
...
...
@@ -4,7 +4,7 @@ import numpy as np
from
multiprocessing
import
Queue
from
labeling_module
import
LabelingModule
#socket에서 수신한 버퍼를 반환
함.
#socket에서 수신한 버퍼를 반환
def
recvall
(
sock
,
count
):
# 바이트 문자열
buf
=
b
''
...
...
@@ -25,22 +25,22 @@ if __name__ == "__main__":
s
=
socket
.
socket
(
socket
.
AF_INET
,
socket
.
SOCK_STREAM
)
print
(
'Socket created'
)
#
서버의 아이피와 포트번호 지정
#
CoreCloud IP, PortNumber set
s
.
bind
((
HOST
,
PORT
))
print
(
'Socket bind complete'
)
#
클라이언트의 접속을 기다린다.
(클라이언트 연결을 10개까지 받는다)
#
Edge Cloud 접속wait
(클라이언트 연결을 10개까지 받는다)
s
.
listen
(
10
)
print
(
'Socket now listening'
)
#연결, conn
에는 소켓 객체, addr은 소켓에 바인드 된 주소
#연결, conn
소켓 객체, addr socket binded addr
conn
,
addr
=
s
.
accept
()
while
True
:
# client에서 받은 stringData
의 크기
(==(str(len(stringData))).encode().ljust(16))
# client에서 받은 stringData
length
(==(str(len(stringData))).encode().ljust(16))
length
=
recvall
(
conn
,
16
)
stringData
=
recvall
(
conn
,
int
(
length
))
data
=
np
.
fromstring
(
stringData
,
dtype
=
'uint8'
)
#data
를 디코딩한다.
#data
decode
cropped
=
cv2
.
imdecode
(
data
,
cv2
.
IMREAD_COLOR
)
cropped
=
cv2
.
resize
(
cropped
,
(
48
,
48
))
#Crop Image Resize
lm
.
new_tensor
(
cropped
)
# Predict result
...
...
Please
register
or
login
to post a comment