Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
s920243400
PaddleDetection
提交
99579e6a
P
PaddleDetection
项目概览
s920243400
/
PaddleDetection
与 Fork 源项目一致
Fork自
PaddlePaddle / PaddleDetection
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
PaddleDetection
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
99579e6a
编写于
5月 07, 2021
作者:
G
Guanghua Yu
提交者:
GitHub
5月 07, 2021
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
remove condition block && some todo (#2882)
上级
0adc553a
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
3 addition
and
19 deletion
+3
-19
deploy/python/visualize.py
deploy/python/visualize.py
+2
-2
ppdet/modeling/heads/solov2_head.py
ppdet/modeling/heads/solov2_head.py
+1
-5
ppdet/modeling/post_process.py
ppdet/modeling/post_process.py
+0
-12
未找到文件。
deploy/python/visualize.py
浏览文件 @
99579e6a
...
...
@@ -38,10 +38,10 @@ def visualize_box_mask(im, results, labels, threshold=0.5):
im
=
Image
.
open
(
im
).
convert
(
'RGB'
)
else
:
im
=
Image
.
fromarray
(
im
)
if
'masks'
in
results
and
'boxes'
in
results
:
if
'masks'
in
results
and
'boxes'
in
results
and
len
(
results
[
'boxes'
])
>
0
:
im
=
draw_mask
(
im
,
results
[
'boxes'
],
results
[
'masks'
],
labels
,
threshold
=
threshold
)
if
'boxes'
in
results
:
if
'boxes'
in
results
and
len
(
results
[
'boxes'
])
>
0
:
im
=
draw_box
(
im
,
results
[
'boxes'
],
labels
,
threshold
=
threshold
)
if
'segm'
in
results
:
im
=
draw_segm
(
...
...
ppdet/modeling/heads/solov2_head.py
浏览文件 @
99579e6a
...
...
@@ -446,9 +446,6 @@ class SOLOv2Head(nn.Layer):
y
=
paddle
.
zeros
(
shape
=
paddle
.
shape
(
cate_preds
),
dtype
=
'float32'
)
inds
=
paddle
.
where
(
cate_preds
>
self
.
score_threshold
,
cate_preds
,
y
)
inds
=
paddle
.
nonzero
(
inds
)
if
paddle
.
shape
(
inds
)[
0
]
==
0
:
out
=
paddle
.
full
(
shape
=
[
1
],
fill_value
=-
1
)
return
out
,
out
,
out
cate_preds
=
paddle
.
reshape
(
cate_preds
,
shape
=
[
-
1
])
# Prevent empty and increase fake data
ind_a
=
paddle
.
cast
(
paddle
.
shape
(
kernel_preds
)[
0
],
'int64'
)
...
...
@@ -530,6 +527,5 @@ class SOLOv2Head(nn.Layer):
align_corners
=
False
,
align_mode
=
0
),
axis
=
[
0
])
# TODO: support bool type
seg_masks
=
paddle
.
cast
(
seg_masks
>
self
.
mask_threshold
,
'int32'
)
seg_masks
=
paddle
.
cast
(
seg_masks
>
self
.
mask_threshold
,
'uint8'
)
return
seg_masks
,
cate_labels
,
cate_scores
ppdet/modeling/post_process.py
浏览文件 @
99579e6a
...
...
@@ -60,14 +60,6 @@ class BBoxPostProcess(object):
else
:
bbox_pred
,
bbox_num
=
self
.
decode
(
head_out
,
rois
,
im_shape
,
scale_factor
)
# Prevent empty bbox_pred from decode or NMS.
# Bboxes and score before NMS may be empty due to the score threshold.
if
bbox_pred
.
shape
[
0
]
==
0
:
bbox_pred
=
paddle
.
to_tensor
(
np
.
array
(
[[
-
1
,
0.0
,
0.0
,
0.0
,
0.0
,
0.0
]],
dtype
=
'float32'
))
bbox_num
=
paddle
.
to_tensor
(
np
.
array
([
1
],
dtype
=
'int32'
))
return
bbox_pred
,
bbox_num
def
get_pred
(
self
,
bboxes
,
bbox_num
,
im_shape
,
scale_factor
):
...
...
@@ -155,10 +147,6 @@ class MaskPostProcess(object):
gx
=
paddle
.
expand
(
img_x
,
[
N
,
img_y
.
shape
[
1
],
img_x
.
shape
[
2
]])
gy
=
paddle
.
expand
(
img_y
,
[
N
,
img_y
.
shape
[
1
],
img_x
.
shape
[
2
]])
# TODO: Because paddle.expand transform error when dygraph
# to static, use reshape to avoid mistakes.
gx
=
paddle
.
reshape
(
gx
,
[
N
,
img_y
.
shape
[
1
],
img_x
.
shape
[
2
]])
gy
=
paddle
.
reshape
(
gy
,
[
N
,
img_y
.
shape
[
1
],
img_x
.
shape
[
2
]])
grid
=
paddle
.
stack
([
gx
,
gy
],
axis
=
3
)
img_masks
=
F
.
grid_sample
(
masks
,
grid
,
align_corners
=
False
)
return
img_masks
[:,
0
]
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录