-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[IE Samples] Improved processing outputs for model with more than one output #10737
Merged
Merged
Changes from 2 commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -345,8 +345,10 @@ int main(int argc, char* argv[]) { | |
// ----------------------------------------------------------------------------------------------------- | ||
// --------------------------- Step 5. Do inference -------------------------------------------------------- | ||
std::vector<std::vector<uint8_t>> ptrUtterances; | ||
std::vector<std::vector<uint8_t>> vectorPtrScores((outputs.size() == 0) ? 1 : outputs.size()); | ||
std::vector<uint16_t> numScoresPerOutput((outputs.size() == 0) ? 1 : outputs.size()); | ||
std::vector<std::vector<uint8_t>> vectorPtrScores((outputs.size() == 0) ? executableNet.outputs().size() | ||
: outputs.size()); | ||
std::vector<uint16_t> numScoresPerOutput((outputs.size() == 0) ? executableNet.outputs().size() | ||
: outputs.size()); | ||
std::vector<std::vector<uint8_t>> vectorPtrReferenceScores(reference_name_files.size()); | ||
std::vector<ScoreErrorT> vectorFrameError(reference_name_files.size()), | ||
vectorTotalError(reference_name_files.size()); | ||
|
@@ -474,8 +476,9 @@ int main(int argc, char* argv[]) { | |
inferRequest.inferRequest.wait(); | ||
if (inferRequest.frameIndex >= 0) | ||
for (size_t next_output = 0; next_output < count_file; next_output++) { | ||
std::string outputName = (outputs.size() == 0) ? executableNet.output(0).get_any_name() | ||
: output_names[next_output]; | ||
std::string outputName = (outputs.size() == 0) | ||
? executableNet.output(next_output).get_any_name() | ||
: output_names[next_output]; | ||
auto dims = executableNet.output(outputName).get_shape(); | ||
numScoresPerOutput[next_output] = std::accumulate(std::begin(dims), | ||
std::end(dims), | ||
|
@@ -493,10 +496,6 @@ int main(int argc, char* argv[]) { | |
|
||
ov::Tensor outputBlob = | ||
inferRequest.inferRequest.get_tensor(executableNet.output(outputName)); | ||
if (!outputs.empty()) { | ||
outputBlob = | ||
inferRequest.inferRequest.get_tensor(executableNet.output(outputName)); | ||
} | ||
// locked memory holder should be alive all time while access to its buffer happens | ||
auto byteSize = numScoresPerOutput[next_output] * sizeof(float); | ||
std::memcpy(outputFrame, outputBlob.data<float>(), byteSize); | ||
|
@@ -654,8 +653,8 @@ int main(int argc, char* argv[]) { | |
} | ||
if (!FLAGS_r.empty()) { | ||
// print statistical score error | ||
std::string outputName = | ||
(outputs.size() == 0) ? executableNet.output(0).get_any_name() : output_names[next_output]; | ||
std::string outputName = (outputs.size() == 0) ? executableNet.output(next_output).get_any_name() | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we are setting this variable 2 times in the code...I would recommend moving this replacement when we are defining outputs vector, but let's do it next time |
||
: output_names[next_output]; | ||
std::cout << "Output name: " << outputName << std::endl; | ||
std::cout << "Number scores per frame: " << numScoresPerOutput[next_output] / batchSize << std::endl | ||
<< std::endl; | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like it is not necessary to define the size of those vectors here it will reduce code size