Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
BlackJayson
yolo_v3
提交
b24c3667
yolo_v3
项目概览
BlackJayson
/
yolo_v3
与 Fork 源项目一致
Fork自
DataBall / yolo_v3
通知
1
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,发现更多精彩内容 >>
提交
b24c3667
编写于
2月 20, 2021
作者:
DataBall
🚴🏻
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add safe hat pretrain model
上级
48841c31
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
21 addition
and
13 deletion
+21
-13
README.md
README.md
+1
-1
predict.py
predict.py
+18
-11
train.py
train.py
+2
-1
未找到文件。
README.md
浏览文件 @
b24c3667
...
...
@@ -90,7 +90,7 @@ h = h*dh
*
[
预训练模型下载地址(百度网盘 Password: ise9 )
](
https://pan.baidu.com/s/1mxiI-tOpE3sU-9TVPJmPWw
)
### 4、安全帽检测预训练模型
*
[
预训练模型下载地址(百度网盘 Password:
)
](
)
*
[
预训练模型下载地址(百度网盘 Password:
inu8 )
](
https://pan.baidu.com/s/1rWUEsPnOTdmfJW4xM8m3Eg
)
## 项目使用方法
...
...
predict.py
浏览文件 @
b24c3667
...
...
@@ -60,6 +60,7 @@ def detect(
img_size
=
416
,
conf_thres
=
0.5
,
nms_thres
=
0.5
,
video_path
=
0
,
):
classes
=
load_classes
(
parse_data_cfg
(
data_cfg
)[
'names'
])
num_classes
=
len
(
classes
)
...
...
@@ -93,7 +94,7 @@ 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
(
"./video/bean_1.mp4"
)
video_capture
=
cv2
.
VideoCapture
(
video_path
)
# url="http://admin:admin@192.168.43.1:8081"
# video_capture=cv2.VideoCapture(url)
...
...
@@ -151,7 +152,11 @@ def detect(
# print(conf, cls_conf)
# xyxy = refine_hand_bbox(xyxy,im0.shape)
xyxy
=
int
(
xyxy
[
0
]),
int
(
xyxy
[
1
])
+
6
,
int
(
xyxy
[
2
]),
int
(
xyxy
[
3
])
if
int
(
cls
)
==
0
:
plot_one_box
(
xyxy
,
im0
,
label
=
label
,
color
=
(
15
,
255
,
95
),
line_thickness
=
3
)
else
:
plot_one_box
(
xyxy
,
im0
,
label
=
label
,
color
=
(
15
,
155
,
255
),
line_thickness
=
3
)
s2
=
time
.
time
()
print
(
"detect time: {}
\n
"
.
format
(
s2
-
t
))
...
...
@@ -177,20 +182,22 @@ def detect(
if
__name__
==
'__main__'
:
voc_config
=
'cfg/person.data'
# 模型相关配置文件
model_path
=
'./weights-yolov3-person/latest_416.pt'
# 检测模型路径
model_cfg
=
'yolo'
# yolo / yolo-tiny
voc_config
=
'cfg/helmet.data'
# 模型相关配置文件
model_path
=
'./weights-yolov3-helmet/hat_416_epoch_410.pt'
# 检测模型路径
model_cfg
=
'yolo'
# yolo / yolo-tiny 模型结构
video_path
=
"./video/hat5.mp4"
# 测试视频
img_size
=
416
# 图像尺寸
conf_thres
=
0.
36
# 检测置信度
nms_thres
=
0.
5
# nms 阈值
conf_thres
=
0.
5
# 检测置信度
nms_thres
=
0.
6
# nms 阈值
with
torch
.
no_grad
():
#设置无梯度运行
with
torch
.
no_grad
():
#设置无梯度运行
模型推理
detect
(
model_path
=
model_path
,
cfg
=
model_cfg
,
data_cfg
=
voc_config
,
img_size
=
img_size
,
conf_thres
=
conf_thres
,
nms_thres
=
nms_thres
,
img_size
=
img_size
,
conf_thres
=
conf_thres
,
nms_thres
=
nms_thres
,
video_path
=
video_path
,
)
train.py
浏览文件 @
b24c3667
...
...
@@ -204,7 +204,8 @@ if __name__ == '__main__':
# train(data_cfg="cfg/hand.data")
# train(data_cfg = "cfg/face.data")
train
(
data_cfg
=
"cfg/person.data"
)
# train(data_cfg = "cfg/person.data")
train
(
data_cfg
=
"cfg/helmet.data"
)
print
(
'well done ~ '
)
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录