-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathxxxx.py
51 lines (41 loc) · 1.5 KB
/
xxxx.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
import cv2
from darkflow.net.build import TFNet
import numpy as np
import time
import os
option = {
'model': 'cfg/tiny-yolo-voc-1c.cfg',
'load': -1,
'threshold': 0.15,
'gpu': 0.5
}
tfnet = TFNet(option)
capture = cv2.VideoCapture('25fps.avi')#25fps.avi,ltest2.MP4,test1.MP4
colors = [tuple(255 * np.random.rand(3)) for i in range(5)]
count = 0
while (capture.isOpened()):
stime = time.time()
ret, frame = capture.read()
results = tfnet.return_predict(frame)
if ret:
for color, result in zip(colors, results):
tl = (result['topleft']['x'], result['topleft']['y'])
br = (result['bottomright']['x'], result['bottomright']['y'])
label = result['label']
if count == 2:
#time.sleep(2)
#os.system("python Skype.py")
os.system("java Client1")
count += 1
print(label)
frame = cv2.rectangle(frame, tl, br, color, 7)
frame = cv2.putText(frame, label, tl, cv2.FONT_HERSHEY_COMPLEX, 1, (0, 0, 0), 2)
cv2.imshow('frame', frame)
# print('FPS {:.1f}'.format(1 / (time.time() - stime)))
if cv2.waitKey(1) & 0xFF == ord('q'):
break
else:
capture.release()
cv2.destroyAllWindows()
break
"""python flow --model cfg/tiny-yolo-1c.cfg --load -1 --train --annotationlast/annotations --dataset last/image --gpu 0.7"""