Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ModelZoo
RetinaFace_migraphx
Commits
ab5a814d
Commit
ab5a814d
authored
Oct 07, 2023
by
liucong
Browse files
修改input/output代码
parent
a8baa52e
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
5 deletions
+28
-5
Python/RetinaFace_infer_migraphx.py
Python/RetinaFace_infer_migraphx.py
+13
-1
Src/RetinaFace.cpp
Src/RetinaFace.cpp
+15
-4
No files found.
Python/RetinaFace_infer_migraphx.py
View file @
ab5a814d
...
@@ -59,8 +59,20 @@ if __name__ == '__main__':
...
@@ -59,8 +59,20 @@ if __name__ == '__main__':
cfg
=
cfg_re50
cfg
=
cfg_re50
device
=
torch
.
device
(
"cpu"
if
args
.
cpu
else
"cuda"
)
device
=
torch
.
device
(
"cpu"
if
args
.
cpu
else
"cuda"
)
model
=
migraphx
.
parse_onnx
(
"./FaceDetector.onnx"
)
model
=
migraphx
.
parse_onnx
(
"./FaceDetector.onnx"
)
# 获取模型输入/输出节点信息
print
(
"inputs:"
)
inputs
=
model
.
get_inputs
()
for
key
,
value
in
inputs
.
items
():
print
(
"{}:{}"
.
format
(
key
,
value
))
print
(
"outputs:"
)
outputs
=
model
.
get_outputs
()
for
key
,
value
in
outputs
.
items
():
print
(
"{}:{}"
.
format
(
key
,
value
))
inputName
=
model
.
get_parameter_names
()[
0
]
inputName
=
model
.
get_parameter_names
()[
0
]
inputShape
=
model
.
get_parameter_shapes
()
[
inputName
].
lens
()
inputShape
=
inputs
[
inputName
].
lens
()
print
(
"inputName:{0}
\n
inputShape:{1}"
.
format
(
inputName
,
inputShape
))
print
(
"inputName:{0}
\n
inputShape:{1}"
.
format
(
inputName
,
inputShape
))
# FP16
# FP16
...
...
Src/RetinaFace.cpp
View file @
ab5a814d
...
@@ -71,10 +71,21 @@ ErrorCode DetectorRetinaFace::Initialize(InitializationParameterOfDetector initi
...
@@ -71,10 +71,21 @@ ErrorCode DetectorRetinaFace::Initialize(InitializationParameterOfDetector initi
net
=
migraphx
::
parse_onnx
(
modelPath
);
net
=
migraphx
::
parse_onnx
(
modelPath
);
LOG_INFO
(
stdout
,
"succeed to load model: %s
\n
"
,
GetFileName
(
modelPath
).
c_str
());
LOG_INFO
(
stdout
,
"succeed to load model: %s
\n
"
,
GetFileName
(
modelPath
).
c_str
());
// 获取模型输入属性
// 获取模型输入/输出节点信息
std
::
unordered_map
<
std
::
string
,
migraphx
::
shape
>
inputMap
=
net
.
get_parameter_shapes
();
std
::
cout
<<
"inputs:"
<<
std
::
endl
;
inputName
=
inputMap
.
begin
()
->
first
;
std
::
unordered_map
<
std
::
string
,
migraphx
::
shape
>
inputs
=
net
.
get_inputs
();
inputShape
=
inputMap
.
begin
()
->
second
;
for
(
auto
i
:
inputs
)
{
std
::
cout
<<
i
.
first
<<
":"
<<
i
.
second
<<
std
::
endl
;
}
std
::
cout
<<
"outputs:"
<<
std
::
endl
;
std
::
unordered_map
<
std
::
string
,
migraphx
::
shape
>
outputs
=
net
.
get_outputs
();
for
(
auto
i
:
outputs
)
{
std
::
cout
<<
i
.
first
<<
":"
<<
i
.
second
<<
std
::
endl
;
}
inputName
=
inputs
.
begin
()
->
first
;
inputShape
=
inputs
.
begin
()
->
second
;
int
N
=
inputShape
.
lens
()[
0
];
int
N
=
inputShape
.
lens
()[
0
];
int
C
=
inputShape
.
lens
()[
1
];
int
C
=
inputShape
.
lens
()[
1
];
int
H
=
inputShape
.
lens
()[
2
];
int
H
=
inputShape
.
lens
()[
2
];
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment