Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
X2Paddle
提交
735be2f1
X
X2Paddle
项目概览
PaddlePaddle
/
X2Paddle
大约 1 年 前同步成功
通知
328
Star
698
Fork
167
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
26
列表
看板
标记
里程碑
合并请求
4
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
X
X2Paddle
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
26
Issue
26
列表
看板
标记
里程碑
合并请求
4
合并请求
4
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
735be2f1
编写于
7月 28, 2020
作者:
J
Jason
提交者:
GitHub
7月 28, 2020
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #327 from Channingss/clip_op
Clip op attr:max set as a float number
上级
184b7388
53071d03
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
7 addition
and
12 deletion
+7
-12
x2paddle/decoder/onnx_shape_inference.py
x2paddle/decoder/onnx_shape_inference.py
+0
-8
x2paddle/op_mapper/paddle2onnx/opset9/paddle_custom_layer/yolo_box.py
...mapper/paddle2onnx/opset9/paddle_custom_layer/yolo_box.py
+7
-4
未找到文件。
x2paddle/decoder/onnx_shape_inference.py
浏览文件 @
735be2f1
...
@@ -545,9 +545,6 @@ class SymbolicShapeInference:
...
@@ -545,9 +545,6 @@ class SymbolicShapeInference:
self
.
sympy_data_
[
node
.
output
[
0
]]
=
data
self
.
sympy_data_
[
node
.
output
[
0
]]
=
data
new_shape
=
np
.
array
(
data
).
shape
new_shape
=
np
.
array
(
data
).
shape
vi
=
self
.
known_vi_
[
node
.
output
[
0
]]
vi
=
self
.
known_vi_
[
node
.
output
[
0
]]
#print(node.output[0])
#print(new_shape)
#vi.CopyFrom(helper.make_tensor_value_info(node.output[0], self.known_vi_[node.input[0]].type.tensor_type.elem_type, list(new_shape)))
def
_pass_on_sympy_data
(
self
,
node
):
def
_pass_on_sympy_data
(
self
,
node
):
assert
len
(
node
.
input
)
==
1
or
node
.
op_type
==
'Reshape'
assert
len
(
node
.
input
)
==
1
or
node
.
op_type
==
'Reshape'
...
@@ -854,12 +851,7 @@ class SymbolicShapeInference:
...
@@ -854,12 +851,7 @@ class SymbolicShapeInference:
axis
=
handle_negative_axis
(
axis
=
handle_negative_axis
(
get_attribute
(
node
,
'axis'
,
0
),
len
(
data_shape
))
get_attribute
(
node
,
'axis'
,
0
),
len
(
data_shape
))
indices_shape
=
self
.
_get_shape
(
node
,
1
)
indices_shape
=
self
.
_get_shape
(
node
,
1
)
#if indices_shape == []:
# value = self._get_initializer_value(node, 1)
# if isinstance(value.tolist(), int):
# indices_shape = [1]
new_shape
=
data_shape
[:
axis
]
+
indices_shape
+
data_shape
[
axis
+
1
:]
new_shape
=
data_shape
[:
axis
]
+
indices_shape
+
data_shape
[
axis
+
1
:]
#print(new_shape)
vi
=
self
.
known_vi_
[
node
.
output
[
0
]]
vi
=
self
.
known_vi_
[
node
.
output
[
0
]]
vi
.
CopyFrom
(
vi
.
CopyFrom
(
helper
.
make_tensor_value_info
(
node
.
output
[
helper
.
make_tensor_value_info
(
node
.
output
[
...
...
x2paddle/op_mapper/paddle2onnx/opset9/paddle_custom_layer/yolo_box.py
浏览文件 @
735be2f1
...
@@ -16,6 +16,9 @@ import onnx
...
@@ -16,6 +16,9 @@ import onnx
import
numpy
as
np
import
numpy
as
np
from
onnx
import
onnx_pb
,
helper
from
onnx
import
onnx_pb
,
helper
MAX_FLOAT32
=
np
.
asarray
(
[
255
,
255
,
127
,
127
],
dtype
=
np
.
uint8
).
view
(
np
.
float32
)[
0
]
def
get_old_name
(
arg
,
name_prefix
=
''
):
def
get_old_name
(
arg
,
name_prefix
=
''
):
prefix_index
=
arg
.
find
(
name_prefix
)
prefix_index
=
arg
.
find
(
name_prefix
)
...
@@ -766,7 +769,7 @@ def yolo_box(op, block):
...
@@ -766,7 +769,7 @@ def yolo_box(op, block):
inputs
=
outputs_pred_box_x1_decode
,
inputs
=
outputs_pred_box_x1_decode
,
outputs
=
outputs_pred_box_x1_clip
,
outputs
=
outputs_pred_box_x1_clip
,
min
=
0.0
,
min
=
0.0
,
max
=
float
(
np
.
inf
))
max
=
float
(
MAX_FLOAT32
))
node_list
.
append
(
node_pred_box_x1_clip
)
node_list
.
append
(
node_pred_box_x1_clip
)
node_pred_box_y1_clip
=
onnx
.
helper
.
make_node
(
node_pred_box_y1_clip
=
onnx
.
helper
.
make_node
(
...
@@ -774,7 +777,7 @@ def yolo_box(op, block):
...
@@ -774,7 +777,7 @@ def yolo_box(op, block):
inputs
=
outputs_pred_box_y1_decode
,
inputs
=
outputs_pred_box_y1_decode
,
outputs
=
outputs_pred_box_y1_clip
,
outputs
=
outputs_pred_box_y1_clip
,
min
=
0.0
,
min
=
0.0
,
max
=
float
(
np
.
inf
))
max
=
float
(
MAX_FLOAT32
))
node_list
.
append
(
node_pred_box_y1_clip
)
node_list
.
append
(
node_pred_box_y1_clip
)
node_pred_box_x2_clip
=
onnx
.
helper
.
make_node
(
node_pred_box_x2_clip
=
onnx
.
helper
.
make_node
(
...
@@ -782,7 +785,7 @@ def yolo_box(op, block):
...
@@ -782,7 +785,7 @@ def yolo_box(op, block):
inputs
=
outputs_pred_box_x2_sub_w
,
inputs
=
outputs_pred_box_x2_sub_w
,
outputs
=
outputs_pred_box_x2_clip
,
outputs
=
outputs_pred_box_x2_clip
,
min
=
0.0
,
min
=
0.0
,
max
=
float
(
np
.
inf
))
max
=
float
(
MAX_FLOAT32
))
node_list
.
append
(
node_pred_box_x2_clip
)
node_list
.
append
(
node_pred_box_x2_clip
)
node_pred_box_y2_clip
=
onnx
.
helper
.
make_node
(
node_pred_box_y2_clip
=
onnx
.
helper
.
make_node
(
...
@@ -790,7 +793,7 @@ def yolo_box(op, block):
...
@@ -790,7 +793,7 @@ def yolo_box(op, block):
inputs
=
outputs_pred_box_y2_sub_h
,
inputs
=
outputs_pred_box_y2_sub_h
,
outputs
=
outputs_pred_box_y2_clip
,
outputs
=
outputs_pred_box_y2_clip
,
min
=
0.0
,
min
=
0.0
,
max
=
float
(
np
.
inf
))
max
=
float
(
MAX_FLOAT32
))
node_list
.
append
(
node_pred_box_y2_clip
)
node_list
.
append
(
node_pred_box_y2_clip
)
outputs_pred_box_x2_res
=
[
model_name
+
"@box_x2_res"
]
outputs_pred_box_x2_res
=
[
model_name
+
"@box_x2_res"
]
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录