Spaces:
Sleeping
Sleeping
Delete server.py
Browse files
server.py
DELETED
|
@@ -1,45 +0,0 @@
|
|
| 1 |
-
import cv2
|
| 2 |
-
import socket
|
| 3 |
-
import pickle
|
| 4 |
-
import numpy as np
|
| 5 |
-
import demo
|
| 6 |
-
|
| 7 |
-
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
|
| 8 |
-
ip = "127.0.0.1"
|
| 9 |
-
port = 6666
|
| 10 |
-
s.bind((ip,port))
|
| 11 |
-
|
| 12 |
-
face_locations = []
|
| 13 |
-
# face_encodings = []
|
| 14 |
-
face_names = []
|
| 15 |
-
process_this_frame = True
|
| 16 |
-
|
| 17 |
-
score = []
|
| 18 |
-
|
| 19 |
-
faces = 0
|
| 20 |
-
|
| 21 |
-
while True:
|
| 22 |
-
print("Hello")
|
| 23 |
-
x = s.recvfrom(1000000)
|
| 24 |
-
clientip = x[1][0]
|
| 25 |
-
data = x[0]
|
| 26 |
-
|
| 27 |
-
data = pickle.loads(data)
|
| 28 |
-
|
| 29 |
-
frame = cv2.imdecode(data, cv2.IMREAD_COLOR)
|
| 30 |
-
|
| 31 |
-
result, process_this_frame, face_locations, faces, face_names, score = demo.process_frame(frame, process_this_frame, face_locations, faces, face_names, score)
|
| 32 |
-
|
| 33 |
-
result = cv2.cvtColor(result, cv2.COLOR_BGR2RGB)
|
| 34 |
-
|
| 35 |
-
cv2.imshow('server side', result)
|
| 36 |
-
|
| 37 |
-
print(score)
|
| 38 |
-
if len(score) > 20:
|
| 39 |
-
avg_score = sum(score) / len(score)
|
| 40 |
-
break
|
| 41 |
-
|
| 42 |
-
if cv2.waitKey(5) & 0xFF == 27:
|
| 43 |
-
break
|
| 44 |
-
|
| 45 |
-
cv2.destroyAllWindows()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|