提交 3c8a3ab7 authored 作者: blu's avatar blu

video detect: time and path

上级 c7f388b0
......@@ -24,6 +24,7 @@ def test(opt):
model.cuda()
cap = cv2.VideoCapture(opt.input)
fps = cap.get(cv2.CAP_PROP_FPS)
bDetected = False
strDetMsg = ''
ts = int((datetime.datetime.now() - tsEpoch).total_seconds())
......@@ -90,7 +91,10 @@ def test(opt):
(xmin, ymin + text_size[1] + 1), font, 1,
(255, 255, 255), 1)
if not bDetected:
strDetMsg = "edet found human {:.3f} x: {}, y: {}, w: {}, h: {}; written image: {}".format(pred_prob, int(xmin), int(ymin), int(xmax-xmin), int(ymax-ymin), fname)
elapse = 0
if fps:
elapse = int(frameCnt / fps)
strDetMsg = "edet found human {:.3f} x: {}, y: {}, w: {}, h: {}; written image: {}; time: {}".format(pred_prob, int(xmin), int(ymin), int(xmax-xmin), int(ymax-ymin), fname, elapse)
bDetected = True
if frameCnt % 1000 == 0:
......
......@@ -173,12 +173,13 @@ def video_analysis(data):
# parse
for line in output.decode('utf-8').split('\n'):
print("\n", line)
m = re.match(r".*? found (\w+) ([\d\.]+) .*? image: .*?/([_\w\d]+.jpg)", line)
m = re.match(r".*? found (\w+) ([\d\.]+) .*? image: .*?/([_\w\d]+.jpg) .*?time: ([\d\.]+)", line)
if m:
ret['data']['humanDetect']['found'] = 1
ret['data']['humanDetect']['level'] = m.group(2)
ret['data']['humanDetect']['image'] = m.group(3)
print('found {}: {}, img: {}'.format(m.group(1), m.group(2), m.group(3)))
ret['data']['humanDetect']['image'] = ipcSn + '/' + dirName + '/' + m.group(3)
ret['data']['humanDetect']['time'] = int(m.group(4))
print('found {}: {}, img: {}, elapse: {}'.format(m.group(1), m.group(2), m.group(3), m.group(4)))
break
else:
ret['data']['humanDetect']['found'] = 0
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论