Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
E
evsuits
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
OpsTeam
evsuits
Commits
352c9446
提交
352c9446
authored
12月 26, 2019
作者:
blu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
object detection
上级
03ed183c
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
18 行增加
和
9 行删除
+18
-9
main.cpp
opencv-yolo/main.cpp
+9
-6
yolo.hpp
opencv-yolo/yolo.hpp
+9
-3
没有找到文件。
opencv-yolo/main.cpp
浏览文件 @
352c9446
...
@@ -6,7 +6,7 @@ using namespace clipp;
...
@@ -6,7 +6,7 @@ using namespace clipp;
using
namespace
std
;
using
namespace
std
;
int
main
(
int
argc
,
char
*
argv
[]){
int
main
(
int
argc
,
char
*
argv
[]){
bool
bHumanOnly
=
true
;
string
bHumanOnly
=
"true"
;
float
fConfident
=
0.1
;
float
fConfident
=
0.1
;
bool
bVerbose
=
false
;
bool
bVerbose
=
false
;
bool
help
=
false
;
bool
help
=
false
;
...
@@ -16,12 +16,12 @@ int main(int argc, char *argv[]){
...
@@ -16,12 +16,12 @@ int main(int argc, char *argv[]){
auto
cli
=
(
auto
cli
=
(
value
(
"input path"
,
sInput
),
value
(
"input path"
,
sInput
),
option
(
"-cl"
)
.
set
(
fConfident
).
doc
(
"confidence level of detection, default: 0.1"
),
option
(
"-cl"
)
&
value
(
"confidence level of detection, default: 0.1"
,
fConfident
),
option
(
"-vv"
,
"--debug"
).
set
(
bVerbose
).
doc
(
"verbose prints"
),
option
(
"-vv"
,
"--debug"
).
set
(
bVerbose
).
doc
(
"verbose prints"
),
option
(
"-human"
,
"--human-only"
)
.
set
(
bHumanOnly
).
doc
(
"detect only human object"
),
option
(
"-human"
,
"--human-only"
)
&
value
(
"detect only human object, default: true"
,
bHumanOnly
),
option
(
"-c"
,
"--config-path"
)
.
set
(
modelPath
).
doc
(
"model and configuration path"
),
option
(
"-c"
,
"--config-path"
)
&
value
(
"model and configuration path"
,
modelPath
),
option
(
"-h"
,
"--help"
).
set
(
help
).
doc
(
"print this help info"
),
option
(
"-h"
,
"--help"
).
set
(
help
).
doc
(
"print this help info"
),
option
(
"-o"
,
"--output"
)
.
set
(
sOutput
).
doc
(
"output, eg: a.jpg; b.avi"
),
option
(
"-o"
,
"--output"
)
&
value
(
"output, eg: a.jpg; b.avi. default: detect.jpg"
,
sOutput
),
option
(
"-r"
,
"--continue"
).
set
(
bCont
).
doc
(
"continue detection, default: false"
)
option
(
"-r"
,
"--continue"
).
set
(
bCont
).
doc
(
"continue detection, default: false"
)
);
);
...
@@ -31,10 +31,12 @@ int main(int argc, char *argv[]){
...
@@ -31,10 +31,12 @@ int main(int argc, char *argv[]){
spdlog
::
info
(
s
.
str
());
spdlog
::
info
(
s
.
str
());
exit
(
0
);
exit
(
0
);
}
}
spdlog
::
info
(
"{} {}"
,
bHumanOnly
,
fConfident
);
if
(
bVerbose
)
{
if
(
bVerbose
)
{
spdlog
::
set_level
(
spdlog
::
level
::
debug
);
spdlog
::
set_level
(
spdlog
::
level
::
debug
);
}
}
YoloDectect
detector
(
modelPath
,
bHumanOnly
,
fConfident
,
bCont
);
YoloDectect
detector
(
modelPath
,
bHumanOnly
==
"true"
?
true
:
false
,
fConfident
,
bCont
);
detector
.
process
(
sInput
,
sOutput
);
detector
.
process
(
sInput
,
sOutput
);
}
}
\ No newline at end of file
opencv-yolo/yolo.hpp
浏览文件 @
352c9446
...
@@ -27,7 +27,7 @@ public:
...
@@ -27,7 +27,7 @@ public:
unsigned
long
numFrameProcessed
=
0
;
unsigned
long
numFrameProcessed
=
0
;
private
:
private
:
// Initialize the parameters
// Initialize the parameters
const
string
selfId
=
"
Yolo
Detector"
;
const
string
selfId
=
"
Object
Detector"
;
float
confThreshold
=
0.1
;
// Confidence threshold
float
confThreshold
=
0.1
;
// Confidence threshold
float
nmsThreshold
=
0.2
;
// Non-maximum suppression threshold
float
nmsThreshold
=
0.2
;
// Non-maximum suppression threshold
int
inpWidth
=
416
;
// Width of network's input image
int
inpWidth
=
416
;
// Width of network's input image
...
@@ -229,7 +229,7 @@ public:
...
@@ -229,7 +229,7 @@ public:
if
(
inVideoUri
.
substr
(
inVideoUri
.
find_last_of
(
"."
)
+
1
)
==
"mp4"
||
(
cameNo
=
stoi
(
inVideoUri
))
>=
0
)
{
if
(
inVideoUri
.
substr
(
inVideoUri
.
find_last_of
(
"."
)
+
1
)
==
"mp4"
||
(
cameNo
=
stoi
(
inVideoUri
))
>=
0
)
{
bInputIsImage
=
false
;
bInputIsImage
=
false
;
}
}
}
catch
(
Exception
&
e
)
{
}
catch
(
...
)
{
}
}
...
@@ -319,7 +319,7 @@ public:
...
@@ -319,7 +319,7 @@ public:
auto
ms
=
chrono
::
duration_cast
<
chrono
::
milliseconds
>
(
chrono
::
system_clock
::
now
().
time_since_epoch
()).
count
();
auto
ms
=
chrono
::
duration_cast
<
chrono
::
milliseconds
>
(
chrono
::
system_clock
::
now
().
time_since_epoch
()).
count
();
string
ofname
=
outFileBase
+
"_person_"
+
to_string
(
ms
)
+
".jpg"
;
string
ofname
=
outFileBase
+
"_person_"
+
to_string
(
ms
)
+
".jpg"
;
imwrite
(
ofname
,
outFrame
);
imwrite
(
ofname
,
outFrame
);
spdlog
::
info
(
"
found human {} x: {}, y: {}, w: {}, h: {}"
,
c
,
r
.
x
,
r
.
y
,
r
.
width
,
r
.
height
);
spdlog
::
info
(
"
{} found human {} x: {}, y: {}, w: {}, h: {}; written image: {}"
,
selfId
,
c
,
r
.
x
,
r
.
y
,
r
.
width
,
r
.
height
,
ofname
);
if
(
!
bContinue
){
if
(
!
bContinue
){
cmdStop
=
true
;
cmdStop
=
true
;
break
;
break
;
...
@@ -330,8 +330,14 @@ public:
...
@@ -330,8 +330,14 @@ public:
if
(
wrapNum
>
0
)
{
if
(
wrapNum
>
0
)
{
detCnt
=
detCnt
%
wrapNum
;
detCnt
=
detCnt
%
wrapNum
;
}
}
string
ofname
=
outFileBase
+
to_string
(
detCnt
)
+
".jpg"
;
string
ofname
=
outFileBase
+
to_string
(
detCnt
)
+
".jpg"
;
imwrite
(
ofname
,
outFrame
);
imwrite
(
ofname
,
outFrame
);
string
msg
=
fmt
::
format
(
"{} found {} {}:
\n
"
,
selfId
,
ret
.
size
(),
ofname
);
for
(
auto
&
[
s
,
c
,
r
]
:
ret
)
{
msg
+=
fmt
::
format
(
"
\t
{} {} x: {}, y: {}, w: {}, h: {}
\n
"
,
s
,
c
,
r
.
x
,
r
.
y
,
r
.
width
,
r
.
height
);
}
spdlog
::
info
(
msg
);
detCnt
++
;
detCnt
++
;
}
}
}
}
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论