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
ResNet50_onnxruntime
Commits
046faa89
Commit
046faa89
authored
Jun 30, 2023
by
yangql
Browse files
Update Src/Classifier.cpp
parent
c1906366
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
1 addition
and
8 deletions
+1
-8
Src/Classifier.cpp
Src/Classifier.cpp
+1
-8
No files found.
Src/Classifier.cpp
View file @
046faa89
...
...
@@ -41,14 +41,11 @@ ErrorCode Classifier::Initialize(InitializationParameterOfClassifier initializat
OrtROCMProviderOptions
rocm_options
;
rocm_options
.
device_id
=
0
;
sessionOptions
.
AppendExecutionProvider_ROCM
(
rocm_options
);
sessionOptions
.
SetGraphOptimizationLevel
(
GraphOptimizationLevel
::
ORT_ENABLE_BASIC
);
// sessionOptions.EnableProfiling("profile_prefix");
session
=
new
Ort
::
Session
(
env
,
modelPath
.
c_str
(),
sessionOptions
);
return
SUCCESS
;
}
ErrorCode
Classifier
::
Classify
(
const
std
::
vector
<
cv
::
Mat
>
&
srcImages
,
std
::
vector
<
std
::
vector
<
ResultOfPrediction
>>
&
predictions
)
...
...
@@ -117,23 +114,19 @@ ErrorCode Classifier::Classify(const std::vector<cv::Mat> &srcImages,std::vector
for
(
int
i
=
0
;
i
<
srcImages
.
size
();
++
i
)
{
int
startIndex
=
numberOfClasses
*
i
;
std
::
vector
<
float
>
logit
;
for
(
int
j
=
0
;
j
<
numberOfClasses
;
++
j
)
{
logit
.
push_back
(
pdata
[
startIndex
+
j
]);
}
}
std
::
vector
<
ResultOfPrediction
>
resultOfPredictions
;
for
(
int
j
=
0
;
j
<
numberOfClasses
;
++
j
)
{
ResultOfPrediction
prediction
;
prediction
.
label
=
j
;
prediction
.
confidence
=
logit
[
j
];
resultOfPredictions
.
push_back
(
prediction
);
}
predictions
.
push_back
(
resultOfPredictions
);
}
return
SUCCESS
;
...
...
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