diff options
Diffstat (limited to 'mv_inference/inference/src/Posture.cpp')
-rw-r--r-- | mv_inference/inference/src/Posture.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/mv_inference/inference/src/Posture.cpp b/mv_inference/inference/src/Posture.cpp index c61f9e56..3fd54d35 100644 --- a/mv_inference/inference/src/Posture.cpp +++ b/mv_inference/inference/src/Posture.cpp @@ -294,7 +294,7 @@ float Posture::getSimilarity(int parts, std::vector<std::pair<bool, std::vector<cv::Vec2f>>>& actionPart) { float score = 0.0f; - int bodyCount = 0; + unsigned int bodyCount = 0; std::vector<int> index; if (parts & MV_INFERENCE_HUMAN_BODY_PART_HEAD) { @@ -327,11 +327,13 @@ float Posture::getSimilarity(int parts, score += cosineSimilarity(posePart[(*it)].second, actionPart[(*it)].second, posePart[(*it)].second.size()); bodyCount += posePart[(*it)].second.size(); - LOGI("body[%d], score[%f], count[%d]", (*it), score, bodyCount); + LOGI("body[%d], score[%f], count[%u]", (*it), score, bodyCount); } } - score /= (float)bodyCount; + if (bodyCount > 0) + score /= (float)bodyCount; + LOGD("score: %1.3f", score); return score; |