Commit 046faa89 authored by yangql's avatar yangql
Browse files

Update Src/Classifier.cpp

parent c1906366
......@@ -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;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment