Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
PaddleX
提交
62daf2fb
P
PaddleX
项目概览
PaddlePaddle
/
PaddleX
通知
138
Star
4
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
43
列表
看板
标记
里程碑
合并请求
5
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
PaddleX
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
43
Issue
43
列表
看板
标记
里程碑
合并请求
5
合并请求
5
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
62daf2fb
编写于
7月 13, 2020
作者:
J
jack
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
encapsulate GenerateColormap in Visualize
上级
92d9a590
变更
4
显示空白变更内容
内联
并排
Showing
4 changed file
with
9 addition
and
12 deletion
+9
-12
deploy/cpp/demo/detector.cpp
deploy/cpp/demo/detector.cpp
+2
-2
deploy/cpp/demo/segmenter.cpp
deploy/cpp/demo/segmenter.cpp
+2
-2
deploy/cpp/include/paddlex/visualize.h
deploy/cpp/include/paddlex/visualize.h
+2
-5
deploy/cpp/src/visualize.cpp
deploy/cpp/src/visualize.cpp
+3
-3
未找到文件。
deploy/cpp/demo/detector.cpp
浏览文件 @
62daf2fb
...
...
@@ -124,7 +124,7 @@ int main(int argc, char** argv) {
// 可视化
for
(
int
j
=
0
;
j
<
im_vec_size
-
i
;
++
j
)
{
cv
::
Mat
vis_img
=
PaddleX
::
Visualize
(
im_vec
[
j
],
results
[
j
],
model
.
labels
,
colormap
,
FLAGS_threshold
);
im_vec
[
j
],
results
[
j
],
model
.
labels
,
FLAGS_threshold
);
std
::
string
save_path
=
PaddleX
::
generate_save_path
(
FLAGS_save_dir
,
image_paths
[
i
+
j
]);
cv
::
imwrite
(
save_path
,
vis_img
);
...
...
@@ -155,7 +155,7 @@ int main(int argc, char** argv) {
// 可视化
cv
::
Mat
vis_img
=
PaddleX
::
Visualize
(
im
,
result
,
model
.
labels
,
colormap
,
FLAGS_threshold
);
PaddleX
::
Visualize
(
im
,
result
,
model
.
labels
,
FLAGS_threshold
);
std
::
string
save_path
=
PaddleX
::
generate_save_path
(
FLAGS_save_dir
,
FLAGS_image
);
cv
::
imwrite
(
save_path
,
vis_img
);
...
...
deploy/cpp/demo/segmenter.cpp
浏览文件 @
62daf2fb
...
...
@@ -106,7 +106,7 @@ int main(int argc, char** argv) {
// 可视化
for
(
int
j
=
0
;
j
<
im_vec_size
-
i
;
++
j
)
{
cv
::
Mat
vis_img
=
PaddleX
::
Visualize
(
im_vec
[
j
],
results
[
j
],
model
.
labels
,
colormap
);
PaddleX
::
Visualize
(
im_vec
[
j
],
results
[
j
],
model
.
labels
);
std
::
string
save_path
=
PaddleX
::
generate_save_path
(
FLAGS_save_dir
,
image_paths
[
i
+
j
]);
cv
::
imwrite
(
save_path
,
vis_img
);
...
...
@@ -124,7 +124,7 @@ int main(int argc, char** argv) {
microseconds
::
period
::
num
/
microseconds
::
period
::
den
;
// 可视化
cv
::
Mat
vis_img
=
PaddleX
::
Visualize
(
im
,
result
,
model
.
labels
,
colormap
);
cv
::
Mat
vis_img
=
PaddleX
::
Visualize
(
im
,
result
,
model
.
labels
);
std
::
string
save_path
=
PaddleX
::
generate_save_path
(
FLAGS_save_dir
,
FLAGS_image
);
cv
::
imwrite
(
save_path
,
vis_img
);
...
...
deploy/cpp/include/paddlex/visualize.h
浏览文件 @
62daf2fb
...
...
@@ -65,13 +65,12 @@ std::vector<int> GenerateColorMap(int num_class);
* @param img: initial image matrix
* @param results: the detection result
* @param labels: label map
* @param
colormap: visualization color map
* @param
threshold: minimum confidence to display
* @return visualized image matrix
* */
cv
::
Mat
Visualize
(
const
cv
::
Mat
&
img
,
const
DetResult
&
results
,
const
std
::
map
<
int
,
std
::
string
>&
labels
,
const
std
::
vector
<
int
>&
colormap
,
float
threshold
=
0.5
);
/*
...
...
@@ -81,13 +80,11 @@ cv::Mat Visualize(const cv::Mat& img,
* @param img: initial image matrix
* @param results: the detection result
* @param labels: label map
* @param colormap: visualization color map
* @return visualized image matrix
* */
cv
::
Mat
Visualize
(
const
cv
::
Mat
&
img
,
const
SegResult
&
result
,
const
std
::
map
<
int
,
std
::
string
>&
labels
,
const
std
::
vector
<
int
>&
colormap
);
const
std
::
map
<
int
,
std
::
string
>&
labels
);
/*
* @brief
...
...
deploy/cpp/src/visualize.cpp
浏览文件 @
62daf2fb
...
...
@@ -34,8 +34,8 @@ std::vector<int> GenerateColorMap(int num_class) {
cv
::
Mat
Visualize
(
const
cv
::
Mat
&
img
,
const
DetResult
&
result
,
const
std
::
map
<
int
,
std
::
string
>&
labels
,
const
std
::
vector
<
int
>&
colormap
,
float
threshold
)
{
auto
colormap
=
GenerateColorMap
(
labels
.
size
());
cv
::
Mat
vis_img
=
img
.
clone
();
auto
boxes
=
result
.
boxes
;
for
(
int
i
=
0
;
i
<
boxes
.
size
();
++
i
)
{
...
...
@@ -107,8 +107,8 @@ cv::Mat Visualize(const cv::Mat& img,
cv
::
Mat
Visualize
(
const
cv
::
Mat
&
img
,
const
SegResult
&
result
,
const
std
::
map
<
int
,
std
::
string
>&
labels
,
const
std
::
vector
<
int
>&
colormap
)
{
const
std
::
map
<
int
,
std
::
string
>&
labels
)
{
auto
colormap
=
GenerateColorMap
(
labels
.
size
());
std
::
vector
<
uint8_t
>
label_map
(
result
.
label_map
.
data
.
begin
(),
result
.
label_map
.
data
.
end
());
cv
::
Mat
mask
(
result
.
label_map
.
shape
[
0
],
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录