Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
weixin_43731813
yolo_v3
提交
f9ae67ef
yolo_v3
项目概览
weixin_43731813
/
yolo_v3
与 Fork 源项目一致
Fork自
DataBall / yolo_v3
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
yolo_v3
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
f9ae67ef
编写于
2月 17, 2021
作者:
DataBall
🚴🏻
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add face detect wrid face
上级
409d75ee
变更
5
显示空白变更内容
内联
并排
Showing
5 changed file
with
42 addition
and
17 deletion
+42
-17
cfg/face.data
cfg/face.data
+15
-0
cfg/face.names
cfg/face.names
+1
-0
predict.py
predict.py
+24
-16
samples/face.gif
samples/face.gif
+0
-0
train.py
train.py
+2
-1
未找到文件。
cfg/face.data
0 → 100644
浏览文件 @
f9ae67ef
cfg_model=yolo
classes=1
gpus = 0
num_workers = 8
batch_size = 8
img_size = 416
multi_scale = True
epochs = 100
train=./yolo_widerface_open_train/anno/train.txt
valid=./yolo_widerface_open_train/anno/train.txt
names=./cfg/face.names
#finetune_model=./coco_model/yolov3_coco.pt
finetune_model = ./weights-yolov3-face/latest_416.pt
lr_step = 10,20,30
lr0 = 0.0001
cfg/face.names
0 → 100644
浏览文件 @
f9ae67ef
Face
predict.py
浏览文件 @
f9ae67ef
...
...
@@ -55,7 +55,6 @@ def refine_hand_bbox(bbox,img_shape):
return
(
x1
,
y1
,
x2
,
y2
)
def
detect
(
model_path
,
root_path
,
cfg
,
data_cfg
,
img_size
=
416
,
...
...
@@ -94,12 +93,20 @@ def detect(
colors
=
[(
v
//
32
*
64
+
64
,
(
v
//
8
)
%
4
*
64
,
v
%
8
*
32
)
for
v
in
range
(
1
,
num_classes
+
1
)][::
-
1
]
video_capture
=
cv2
.
VideoCapture
(
0
)
video_capture
=
cv2
.
VideoCapture
(
"./video/bean.mp4"
)
# url="http://admin:admin@192.168.43.1:8081"
# video_capture=cv2.VideoCapture(url)
video_writer
=
None
loc_time
=
time
.
localtime
()
str_time
=
time
.
strftime
(
"%Y-%m-%d_%H-%M-%S"
,
loc_time
)
save_video_path
=
"./demo/demo_{}.mp4"
.
format
(
str_time
)
#-------------------------------------------------
while
True
:
ret
,
im0
=
video_capture
.
read
()
if
ret
:
t
=
time
.
time
()
# im0 = cv2.imread("samples/5.png")
img
=
process_data
(
im0
,
img_size
)
if
use_cuda
:
torch
.
cuda
.
synchronize
()
...
...
@@ -140,8 +147,11 @@ def detect(
# Draw bounding boxes and labels of detections
for
*
xyxy
,
conf
,
cls_conf
,
cls
in
detections
:
label
=
'%s %.2f'
%
(
classes
[
int
(
cls
)],
conf
)
# label = '%s' % (classes[int(cls)])
# print(conf, cls_conf)
# xyxy = refine_hand_bbox(xyxy,im0.shape)
plot_one_box
(
xyxy
,
im0
,
label
=
label
,
color
=
(
255
,
255
,
0
)
)
plot_one_box
(
xyxy
,
im0
,
label
=
label
,
color
=
(
155
,
55
,
255
),
line_thickness
=
3
)
s2
=
time
.
time
()
print
(
"detect time: {}
\n
"
.
format
(
s2
-
t
))
...
...
@@ -153,33 +163,31 @@ def detect(
cv2
.
namedWindow
(
'image'
,
0
)
cv2
.
imshow
(
"image"
,
im0
)
key
=
cv2
.
waitKey
(
1
)
if
video_writer
is
None
:
fourcc
=
cv2
.
VideoWriter_fourcc
(
*
"mp4v"
)
video_writer
=
cv2
.
VideoWriter
(
save_video_path
,
fourcc
,
fps
=
25
,
frameSize
=
(
im0
.
shape
[
1
],
im0
.
shape
[
0
]))
video_writer
.
write
(
im0
)
if
key
==
27
:
break
else
:
break
cv2
.
destroyAllWindows
()
video_writer
.
release
()
if
__name__
==
'__main__'
:
pattern
=
'yolo'
if
"-tiny"
in
pattern
:
model_path
=
'./weights-yolov3-person-tiny/latest_320.pt'
# 检测模型路径
root_path
=
'./test_images/'
# 测试文件夹
model_cfg
=
pattern
# 模型类型
else
:
model_path
=
'./weights-yolov3-hand/latest_416.pt'
# 检测模型路径
root_path
=
'./test_images/'
# 测试文件夹
model_cfg
=
'yolov3'
# 模型类型
voc_config
=
'cfg/hand.data'
# 模型相关配置文件
voc_config
=
'cfg/face.data'
# 模型相关配置文件
model_path
=
'./weights-yolov3-face/latest_416.pt'
# 检测模型路径
model_cfg
=
'yolo'
# yolo / yolo-tiny
img_size
=
416
# 图像尺寸
conf_thres
=
0.
25
# 检测置信度
nms_thres
=
0.
4
5
# nms 阈值
conf_thres
=
0.
36
# 检测置信度
nms_thres
=
0.5
# nms 阈值
with
torch
.
no_grad
():
#设置无梯度运行
detect
(
model_path
=
model_path
,
root_path
=
root_path
,
cfg
=
model_cfg
,
data_cfg
=
voc_config
,
img_size
=
img_size
,
...
...
samples/face.gif
0 → 100644
浏览文件 @
f9ae67ef
6.0 MB
train.py
浏览文件 @
f9ae67ef
...
...
@@ -202,7 +202,8 @@ def train(data_cfg ='cfg/voc.data',
if
__name__
==
'__main__'
:
train
(
data_cfg
=
'cfg/hand.data'
)
# train(data_cfg="cfg/hand.data")
train
(
data_cfg
=
"cfg/face.data"
)
print
(
'well done ~ '
)
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录