未验证 提交 f8853c4c 编写于 作者: Z Zeyu Chen 提交者: GitHub

Fix export_model version to 1.1.0

update model version=1.1.0 & mobile->server
...@@ -32,7 +32,7 @@ ...@@ -32,7 +32,7 @@
#### 加载预训练模型 #### 加载预训练模型
```python ```python
import paddlehub as hub import paddlehub as hub
module = hub.Module(name="pyramidbox_lite_mobile_mask") #口罩检测模型 module = hub.Module(name="pyramidbox_lite_server_mask", version='1.1.0') #口罩检测模型
``` ```
>以上语句paddlehub会自动下载口罩检测模型 "pyramidbox_lite_mobile_mask" 不需要提前下载模型 >以上语句paddlehub会自动下载口罩检测模型 "pyramidbox_lite_mobile_mask" 不需要提前下载模型
......
...@@ -6,7 +6,7 @@ import numpy as np ...@@ -6,7 +6,7 @@ import numpy as np
import json import json
import os import os
module = hub.Module(name="pyramidbox_lite_mobile_mask") module = hub.Module(name="pyramidbox_lite_server_mask", version='1.1.0')
# opencv输出中文 # opencv输出中文
def paint_chinese(im, chinese, position, fontsize, color_bgr): def paint_chinese(im, chinese, position, fontsize, color_bgr):
...@@ -29,8 +29,8 @@ if not os.path.exists(result_path): ...@@ -29,8 +29,8 @@ if not os.path.exists(result_path):
os.mkdir(result_path) os.mkdir(result_path)
name = "./result/1-mask_detection.mp4" name = "./result/1-mask_detection.mp4"
width = 1920 width = 1280
height = 1080 height = 720
fps = 30 fps = 30
fourcc = cv2.VideoWriter_fourcc(*'mp4v') fourcc = cv2.VideoWriter_fourcc(*'mp4v')
writer = cv2.VideoWriter(name, fourcc, fps, (width, height)) writer = cv2.VideoWriter(name, fourcc, fps, (width, height))
...@@ -40,7 +40,7 @@ index = 0 ...@@ -40,7 +40,7 @@ index = 0
data = [] data = []
capture = cv2.VideoCapture(0) # 打开摄像头 capture = cv2.VideoCapture(0) # 打开摄像头
# capture = cv2.VideoCapture('./test_video.mp4') # 打开视频文件 #capture = cv2.VideoCapture('./test_video.mp4') # 打开视频文件
while True: while True:
frameData = {} frameData = {}
ret, frame = capture.read() # frame即视频的一帧数据 ret, frame = capture.read() # frame即视频的一帧数据
...@@ -88,10 +88,10 @@ while True: ...@@ -88,10 +88,10 @@ while True:
label_cn = "无口罩" label_cn = "无口罩"
cv2.rectangle(frame_copy, (left, top), (right, bottom), color, 3) cv2.rectangle(frame_copy, (left, top), (right, bottom), color, 3)
# cv2.putText(frame, label, (left, top-10), cv2.FONT_HERSHEY_SIMPLEX, 0.8, color, 2) cv2.putText(frame_copy, label, (left, top-10), cv2.FONT_HERSHEY_SIMPLEX, 0.8, color, 2)
origin_point = (left, top - 36) #origin_point = (left, top - 36)
frame_copy = paint_chinese(frame_copy, label_cn, origin_point, 24, #frame_copy = paint_chinese(frame_copy, label_cn, origin_point, 24,
color) # color)
writer.write(frame_copy) writer.write(frame_copy)
......
<?php <?php
$json_string = file_get_contents(".\\video\\result\\2-mask_detection.json"); $json_string = file_get_contents(".\\video\\result\\2-mask_detection.json");
// 用参数true把JSON字符串强制转成PHP数组 // 用参数true把JSON字符串强制转成PHP数组
$data_o = json_decode($json_string, true); $data_o = json_decode($json_string, true);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册