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
yolov5_migraphx
Commits
3157901f
Commit
3157901f
authored
Jun 19, 2023
by
shizhm
Browse files
完善C++代码
parent
cd05e0f0
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
14 deletions
+14
-14
Src/YOLOV5.cpp
Src/YOLOV5.cpp
+14
-14
No files found.
Src/YOLOV5.cpp
View file @
3157901f
...
...
@@ -54,15 +54,15 @@ ErrorCode DetectorYOLOV5::Initialize(InitializationParameterOfDetector initializ
yolov5Parameter
.
numberOfClasses
=
(
int
)
netNode
[
"NumberOfClasses"
];
useFP16
=
(
bool
)(
int
)
netNode
[
"UseFP16"
];
if
(
Exists
(
modelPath
)
==
false
)
{
LOG_ERROR
(
stdout
,
"%s not exist!
\n
"
,
modelPath
.
c_str
());
return
MODEL_NOT_EXIST
;
}
// 加载模型
if
(
dynamic
)
{
// 加载模型
if
(
Exists
(
modelPath
)
==
false
)
{
LOG_ERROR
(
stdout
,
"%s not exist!
\n
"
,
modelPath
.
c_str
());
return
MODEL_NOT_EXIST
;
}
migraphx
::
onnx_options
onnx_options
;
onnx_options
.
map_input_dims
[
"images"
]
=
{
1
,
3
,
800
,
800
};
//
net
=
migraphx
::
parse_onnx
(
modelPath
,
onnx_options
);
...
...
@@ -83,12 +83,6 @@ ErrorCode DetectorYOLOV5::Initialize(InitializationParameterOfDetector initializ
}
else
{
// 加载模型
if
(
Exists
(
modelPath
)
==
false
)
{
LOG_ERROR
(
stdout
,
"%s not exist!
\n
"
,
modelPath
.
c_str
());
return
MODEL_NOT_EXIST
;
}
net
=
migraphx
::
parse_onnx
(
modelPath
);
LOG_INFO
(
stdout
,
"succeed to load model: %s
\n
"
,
GetFileName
(
modelPath
).
c_str
());
...
...
@@ -169,7 +163,13 @@ ErrorCode DetectorYOLOV5::Detect(const cv::Mat &srcImage, std::vector<ResultOfDe
width
=
srcImage
.
rows
;
height
=
srcImage
.
cols
;
relInputShape
=
{
1
,
3
,
height
,
width
};
inputBlob
=
cv
::
dnn
::
blobFromImage
(
srcImage
);
cv
::
dnn
::
blobFromImage
(
srcImage
,
inputBlob
,
1
/
255.0
,
cv
::
Size
(
width
,
height
),
cv
::
Scalar
(
0
,
0
,
0
),
true
,
false
);
}
else
{
...
...
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