Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
s920243400
PaddleDetection
提交
df4a27c6
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看板
未验证
提交
df4a27c6
编写于
4月 12, 2022
作者:
H
hong
提交者:
GitHub
4月 12, 2022
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
change core.ops to _C_ops (#5663)
上级
4bdb7471
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
14 addition
and
13 deletion
+14
-13
ppdet/modeling/ops.py
ppdet/modeling/ops.py
+14
-13
未找到文件。
ppdet/modeling/ops.py
浏览文件 @
df4a27c6
...
...
@@ -17,6 +17,7 @@ import paddle.nn.functional as F
import
paddle.nn
as
nn
from
paddle
import
ParamAttr
from
paddle.regularizer
import
L2Decay
from
paddle
import
_C_ops
from
paddle.fluid.framework
import
Variable
,
in_dygraph_mode
from
paddle.fluid
import
core
...
...
@@ -174,7 +175,7 @@ def roi_pool(input,
pooled_height
,
pooled_width
=
output_size
if
in_dygraph_mode
():
assert
rois_num
is
not
None
,
"rois_num should not be None in dygraph mode."
pool_out
,
argmaxes
=
core
.
ops
.
roi_pool
(
pool_out
,
argmaxes
=
_C_
ops
.
roi_pool
(
input
,
rois
,
rois_num
,
"pooled_height"
,
pooled_height
,
"pooled_width"
,
pooled_width
,
"spatial_scale"
,
spatial_scale
)
return
pool_out
,
argmaxes
...
...
@@ -281,7 +282,7 @@ def roi_align(input,
if
in_dygraph_mode
():
assert
rois_num
is
not
None
,
"rois_num should not be None in dygraph mode."
align_out
=
core
.
ops
.
roi_align
(
align_out
=
_C_
ops
.
roi_align
(
input
,
rois
,
rois_num
,
"pooled_height"
,
pooled_height
,
"pooled_width"
,
pooled_width
,
"spatial_scale"
,
spatial_scale
,
"sampling_ratio"
,
sampling_ratio
,
"aligned"
,
aligned
)
...
...
@@ -364,7 +365,7 @@ def iou_similarity(x, y, box_normalized=True, name=None):
"""
if
in_dygraph_mode
():
out
=
core
.
ops
.
iou_similarity
(
x
,
y
,
'box_normalized'
,
box_normalized
)
out
=
_C_
ops
.
iou_similarity
(
x
,
y
,
'box_normalized'
,
box_normalized
)
return
out
else
:
helper
=
LayerHelper
(
"iou_similarity"
,
**
locals
())
...
...
@@ -460,7 +461,7 @@ def collect_fpn_proposals(multi_rois,
if
in_dygraph_mode
():
assert
rois_num_per_level
is
not
None
,
"rois_num_per_level should not be None in dygraph mode."
attrs
=
(
'post_nms_topN'
,
post_nms_top_n
)
output_rois
,
rois_num
=
core
.
ops
.
collect_fpn_proposals
(
output_rois
,
rois_num
=
_C_
ops
.
collect_fpn_proposals
(
input_rois
,
input_scores
,
rois_num_per_level
,
*
attrs
)
return
output_rois
,
rois_num
...
...
@@ -575,7 +576,7 @@ def distribute_fpn_proposals(fpn_rois,
attrs
=
(
'min_level'
,
min_level
,
'max_level'
,
max_level
,
'refer_level'
,
refer_level
,
'refer_scale'
,
refer_scale
,
'pixel_offset'
,
pixel_offset
)
multi_rois
,
restore_ind
,
rois_num_per_level
=
core
.
ops
.
distribute_fpn_proposals
(
multi_rois
,
restore_ind
,
rois_num_per_level
=
_C_
ops
.
distribute_fpn_proposals
(
fpn_rois
,
rois_num
,
num_lvl
,
num_lvl
,
*
attrs
)
return
multi_rois
,
restore_ind
,
rois_num_per_level
...
...
@@ -729,7 +730,7 @@ def yolo_box(
attrs
=
(
'anchors'
,
anchors
,
'class_num'
,
class_num
,
'conf_thresh'
,
conf_thresh
,
'downsample_ratio'
,
downsample_ratio
,
'clip_bbox'
,
clip_bbox
,
'scale_x_y'
,
scale_x_y
)
boxes
,
scores
=
core
.
ops
.
yolo_box
(
x
,
origin_shape
,
*
attrs
)
boxes
,
scores
=
_C_
ops
.
yolo_box
(
x
,
origin_shape
,
*
attrs
)
return
boxes
,
scores
else
:
boxes
=
helper
.
create_variable_for_type_inference
(
dtype
=
x
.
dtype
)
...
...
@@ -867,7 +868,7 @@ def prior_box(input,
'min_max_aspect_ratios_order'
,
min_max_aspect_ratios_order
)
if
cur_max_sizes
is
not
None
:
attrs
+=
(
'max_sizes'
,
cur_max_sizes
)
box
,
var
=
core
.
ops
.
prior_box
(
input
,
image
,
*
attrs
)
box
,
var
=
_C_
ops
.
prior_box
(
input
,
image
,
*
attrs
)
return
box
,
var
else
:
attrs
=
{
...
...
@@ -1010,7 +1011,7 @@ def multiclass_nms(bboxes,
score_threshold
,
'nms_top_k'
,
nms_top_k
,
'nms_threshold'
,
nms_threshold
,
'keep_top_k'
,
keep_top_k
,
'nms_eta'
,
nms_eta
,
'normalized'
,
normalized
)
output
,
index
,
nms_rois_num
=
core
.
ops
.
multiclass_nms3
(
bboxes
,
scores
,
output
,
index
,
nms_rois_num
=
_C_
ops
.
multiclass_nms3
(
bboxes
,
scores
,
rois_num
,
*
attrs
)
if
not
return_index
:
index
=
None
...
...
@@ -1152,7 +1153,7 @@ def matrix_nms(bboxes,
nms_top_k
,
'gaussian_sigma'
,
gaussian_sigma
,
'use_gaussian'
,
use_gaussian
,
'keep_top_k'
,
keep_top_k
,
'normalized'
,
normalized
)
out
,
index
,
rois_num
=
core
.
ops
.
matrix_nms
(
bboxes
,
scores
,
*
attrs
)
out
,
index
,
rois_num
=
_C_
ops
.
matrix_nms
(
bboxes
,
scores
,
*
attrs
)
if
not
return_index
:
index
=
None
if
not
return_rois_num
:
...
...
@@ -1273,7 +1274,7 @@ def bipartite_match(dist_matrix,
[
'float32'
,
'float64'
],
'bipartite_match'
)
if
in_dygraph_mode
():
match_indices
,
match_distance
=
core
.
ops
.
bipartite_match
(
match_indices
,
match_distance
=
_C_
ops
.
bipartite_match
(
dist_matrix
,
"match_type"
,
match_type
,
"dist_threshold"
,
dist_threshold
)
return
match_indices
,
match_distance
...
...
@@ -1410,12 +1411,12 @@ def box_coder(prior_box,
if
in_dygraph_mode
():
if
isinstance
(
prior_box_var
,
Variable
):
output_box
=
core
.
ops
.
box_coder
(
output_box
=
_C_
ops
.
box_coder
(
prior_box
,
prior_box_var
,
target_box
,
"code_type"
,
code_type
,
"box_normalized"
,
box_normalized
,
"axis"
,
axis
)
elif
isinstance
(
prior_box_var
,
list
):
output_box
=
core
.
ops
.
box_coder
(
output_box
=
_C_
ops
.
box_coder
(
prior_box
,
None
,
target_box
,
"code_type"
,
code_type
,
"box_normalized"
,
box_normalized
,
"axis"
,
axis
,
"variance"
,
prior_box_var
)
...
...
@@ -1538,7 +1539,7 @@ def generate_proposals(scores,
attrs
=
(
'pre_nms_topN'
,
pre_nms_top_n
,
'post_nms_topN'
,
post_nms_top_n
,
'nms_thresh'
,
nms_thresh
,
'min_size'
,
min_size
,
'eta'
,
eta
,
'pixel_offset'
,
pixel_offset
)
rpn_rois
,
rpn_roi_probs
,
rpn_rois_num
=
core
.
ops
.
generate_proposals_v2
(
rpn_rois
,
rpn_roi_probs
,
rpn_rois_num
=
_C_
ops
.
generate_proposals_v2
(
scores
,
bbox_deltas
,
im_shape
,
anchors
,
variances
,
*
attrs
)
if
not
return_rois_num
:
rpn_rois_num
=
None
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录