Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
PaddleX
提交
764455a5
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看板
提交
764455a5
编写于
8月 12, 2020
作者:
F
FlyingQianMM
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'develop' of
https://github.com/PaddlePaddle/PaddleX
into develop_qh
上级
33896dcf
b692eb6d
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
11 addition
and
6 deletion
+11
-6
deploy/lite/android/sdk/src/main/java/com/baidu/paddlex/visual/Visualize.java
...sdk/src/main/java/com/baidu/paddlex/visual/Visualize.java
+5
-6
paddlex/tools/dataset_split/seg_split.py
paddlex/tools/dataset_split/seg_split.py
+3
-0
paddlex/tools/dataset_split/voc_split.py
paddlex/tools/dataset_split/voc_split.py
+3
-0
未找到文件。
deploy/lite/android/sdk/src/main/java/com/baidu/paddlex/visual/Visualize.java
浏览文件 @
764455a5
...
@@ -118,13 +118,15 @@ public class Visualize {
...
@@ -118,13 +118,15 @@ public class Visualize {
public
Mat
draw
(
SegResult
result
,
Mat
visualizeMat
,
ImageBlob
imageBlob
,
int
cutoutClass
)
{
public
Mat
draw
(
SegResult
result
,
Mat
visualizeMat
,
ImageBlob
imageBlob
,
int
cutoutClass
)
{
int
new_h
=
(
int
)
imageBlob
.
getNewImageSize
()[
2
];
int
new_h
=
(
int
)
imageBlob
.
getNewImageSize
()[
2
];
int
new_w
=
(
int
)
imageBlob
.
getNewImageSize
()[
3
];
int
new_w
=
(
int
)
imageBlob
.
getNewImageSize
()[
3
];
Mat
mask
=
new
Mat
(
new_h
,
new_w
,
CvType
.
CV_
8U
C
(
1
));
Mat
mask
=
new
Mat
(
new_h
,
new_w
,
CvType
.
CV_
32F
C
(
1
));
float
[]
scoreData
=
new
float
[
new_h
*
new_w
];
for
(
int
h
=
0
;
h
<
new_h
;
h
++)
{
for
(
int
h
=
0
;
h
<
new_h
;
h
++)
{
for
(
int
w
=
0
;
w
<
new_w
;
w
++){
for
(
int
w
=
0
;
w
<
new_w
;
w
++){
mask
.
put
(
h
,
w
,
(
1
-
result
.
getMask
().
getScoreData
()[
cutoutClass
+
h
*
new_h
+
w
])
*
255
)
;
scoreData
[
new_h
*
h
+
w
]
=
(
1
-
result
.
getMask
().
getScoreData
()[
cutoutClass
+
h
*
new_h
+
w
])
*
255
;
}
}
}
}
mask
.
put
(
0
,
0
,
scoreData
);
mask
.
convertTo
(
mask
,
CvType
.
CV_8UC
(
1
));
ListIterator
<
Map
.
Entry
<
String
,
int
[]>>
reverseReshapeInfo
=
new
ArrayList
<
Map
.
Entry
<
String
,
int
[]>>(
imageBlob
.
getReshapeInfo
().
entrySet
()).
listIterator
(
imageBlob
.
getReshapeInfo
().
size
());
ListIterator
<
Map
.
Entry
<
String
,
int
[]>>
reverseReshapeInfo
=
new
ArrayList
<
Map
.
Entry
<
String
,
int
[]>>(
imageBlob
.
getReshapeInfo
().
entrySet
()).
listIterator
(
imageBlob
.
getReshapeInfo
().
size
());
while
(
reverseReshapeInfo
.
hasPrevious
())
{
while
(
reverseReshapeInfo
.
hasPrevious
())
{
Map
.
Entry
<
String
,
int
[]>
entry
=
reverseReshapeInfo
.
previous
();
Map
.
Entry
<
String
,
int
[]>
entry
=
reverseReshapeInfo
.
previous
();
...
@@ -135,10 +137,7 @@ public class Visualize {
...
@@ -135,10 +137,7 @@ public class Visualize {
Size
sz
=
new
Size
(
entry
.
getValue
()[
0
],
entry
.
getValue
()[
1
]);
Size
sz
=
new
Size
(
entry
.
getValue
()[
0
],
entry
.
getValue
()[
1
]);
Imgproc
.
resize
(
mask
,
mask
,
sz
,
0
,
0
,
Imgproc
.
INTER_LINEAR
);
Imgproc
.
resize
(
mask
,
mask
,
sz
,
0
,
0
,
Imgproc
.
INTER_LINEAR
);
}
}
Log
.
i
(
TAG
,
"postprocess operator: "
+
entry
.
getKey
());
Log
.
i
(
TAG
,
"shape:: "
+
String
.
valueOf
(
mask
.
width
())
+
","
+
String
.
valueOf
(
mask
.
height
()));
}
}
Mat
dst
=
new
Mat
();
Mat
dst
=
new
Mat
();
List
<
Mat
>
listMat
=
Arrays
.
asList
(
visualizeMat
,
mask
);
List
<
Mat
>
listMat
=
Arrays
.
asList
(
visualizeMat
,
mask
);
Core
.
merge
(
listMat
,
dst
);
Core
.
merge
(
listMat
,
dst
);
...
...
paddlex/tools/dataset_split/seg_split.py
浏览文件 @
764455a5
...
@@ -39,6 +39,9 @@ def split_seg_dataset(dataset_dir, val_percent, test_percent, save_dir):
...
@@ -39,6 +39,9 @@ def split_seg_dataset(dataset_dir, val_percent, test_percent, save_dir):
anno_name
=
replace_ext
(
image_file
,
"PNG"
)
anno_name
=
replace_ext
(
image_file
,
"PNG"
)
if
osp
.
exists
(
osp
.
join
(
dataset_dir
,
"Annotations"
,
anno_name
)):
if
osp
.
exists
(
osp
.
join
(
dataset_dir
,
"Annotations"
,
anno_name
)):
image_anno_list
.
append
([
image_file
,
anno_name
])
image_anno_list
.
append
([
image_file
,
anno_name
])
else
:
logging
.
error
(
"The annotation file {} doesn't exist!"
.
format
(
anno_name
))
if
not
osp
.
exists
(
osp
.
join
(
dataset_dir
,
"labels.txt"
)):
if
not
osp
.
exists
(
osp
.
join
(
dataset_dir
,
"labels.txt"
)):
for
image_anno
in
image_anno_list
:
for
image_anno
in
image_anno_list
:
...
...
paddlex/tools/dataset_split/voc_split.py
浏览文件 @
764455a5
...
@@ -47,6 +47,9 @@ def split_voc_dataset(dataset_dir, val_percent, test_percent, save_dir):
...
@@ -47,6 +47,9 @@ def split_voc_dataset(dataset_dir, val_percent, test_percent, save_dir):
cname
=
obj
.
find
(
'name'
).
text
cname
=
obj
.
find
(
'name'
).
text
if
not
cname
in
label_list
:
if
not
cname
in
label_list
:
label_list
.
append
(
cname
)
label_list
.
append
(
cname
)
else
:
logging
.
error
(
"The annotation file {} doesn't exist!"
.
format
(
anno_name
))
random
.
shuffle
(
image_anno_list
)
random
.
shuffle
(
image_anno_list
)
image_num
=
len
(
image_anno_list
)
image_num
=
len
(
image_anno_list
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录