diff options
author | Narumol Prangnawarat <narumol.prangnawarat@arm.com> | 2019-02-04 11:46:26 +0000 |
---|---|---|
committer | Nina Drozd <nina.drozd@arm.com> | 2019-02-08 10:07:20 +0000 |
commit | 6d302bfb568962f3b6b6f012b260ce54f22d36a0 (patch) | |
tree | 86147d527e36751392539f363e5aa702e49f2fc7 /src/backends/reference/workloads/DetectionPostProcess.cpp | |
parent | 61980d472006abdf3778d23903fb3bec5916f1f2 (diff) | |
download | armnn-6d302bfb568962f3b6b6f012b260ce54f22d36a0.tar.gz |
IVGCVSW-2559 End to end tests for Detection PostProcess
* end to end tests for Detection PostProcess float and uint8
* add anchors to AddDetectionPostProcessLayer
* add anchors to VisitDetectionPostProcessLayer
* refactor code
Change-Id: I3c5a9a4a60b74c2246b4a27692bbf3c235163f90
Signed-off-by: Narumol Prangnawarat <narumol.prangnawarat@arm.com>
Diffstat (limited to 'src/backends/reference/workloads/DetectionPostProcess.cpp')
-rw-r--r-- | src/backends/reference/workloads/DetectionPostProcess.cpp | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/backends/reference/workloads/DetectionPostProcess.cpp b/src/backends/reference/workloads/DetectionPostProcess.cpp index 958de8294b..2eb35f5ffa 100644 --- a/src/backends/reference/workloads/DetectionPostProcess.cpp +++ b/src/backends/reference/workloads/DetectionPostProcess.cpp @@ -105,15 +105,15 @@ void AllocateOutputData(unsigned int numOutput, unsigned int numSelected, const for (unsigned int i = 0; i < numOutput; ++i) { unsigned int boxIndex = i * 4; - unsigned int boxConorIndex = selectedBoxes[outputIndices[i]] * 4; if (i < numSelected) { + unsigned int boxCornorIndex = selectedBoxes[outputIndices[i]] * 4; detectionScores[i] = selectedScores[outputIndices[i]]; detectionClasses[i] = boost::numeric_cast<float>(selectedClasses[outputIndices[i]]); - detectionBoxes[boxIndex] = boxCorners[boxConorIndex]; - detectionBoxes[boxIndex + 1] = boxCorners[boxConorIndex + 1]; - detectionBoxes[boxIndex + 2] = boxCorners[boxConorIndex + 2]; - detectionBoxes[boxIndex + 3] = boxCorners[boxConorIndex + 3]; + detectionBoxes[boxIndex] = boxCorners[boxCornorIndex]; + detectionBoxes[boxIndex + 1] = boxCorners[boxCornorIndex + 1]; + detectionBoxes[boxIndex + 2] = boxCorners[boxCornorIndex + 2]; + detectionBoxes[boxIndex + 3] = boxCorners[boxCornorIndex + 3]; } else { @@ -125,7 +125,7 @@ void AllocateOutputData(unsigned int numOutput, unsigned int numSelected, const detectionBoxes[boxIndex + 3] = 0.0f; } } - numDetections[0] = boost::numeric_cast<float>(numOutput); + numDetections[0] = boost::numeric_cast<float>(numSelected); } } // anonymous namespace @@ -216,7 +216,7 @@ void DetectionPostProcess(const TensorInfo& boxEncodingsInfo, std::vector<unsigned int> outputIndices = GenerateRangeK(numSelected); TopKSort(numOutput, outputIndices.data(), selectedScoresAfterNms.data(), numSelected); - AllocateOutputData(numOutput, numSelected, boxCorners, outputIndices, + AllocateOutputData(detectionBoxesInfo.GetShape()[1], numOutput, boxCorners, outputIndices, selectedBoxesAfterNms, selectedClasses, selectedScoresAfterNms, detectionBoxes, detectionScores, detectionClasses, numDetections); } @@ -255,7 +255,7 @@ void DetectionPostProcess(const TensorInfo& boxEncodingsInfo, unsigned int numSelected = boost::numeric_cast<unsigned int>(selectedIndices.size()); unsigned int numOutput = std::min(desc.m_MaxDetections, numSelected); - AllocateOutputData(numOutput, numSelected, boxCorners, selectedIndices, + AllocateOutputData(detectionBoxesInfo.GetShape()[1], numOutput, boxCorners, selectedIndices, boxIndices, maxScoreClasses, maxScores, detectionBoxes, detectionScores, detectionClasses, numDetections); } |