mv_machine_learning: code cleanup by dropping unnecessary code 68/319068/4
authorInki Dae <inki.dae@samsung.com>
Tue, 4 Feb 2025 01:30:13 +0000 (10:30 +0900)
committerInki Dae <inki.dae@samsung.com>
Mon, 10 Feb 2025 08:15:07 +0000 (17:15 +0900)
Change-Id: I507f00ce524777798960a668a41ef60ee769bb33
Signed-off-by: Inki Dae <inki.dae@samsung.com>
mv_machine_learning/object_detection/src/HailoYoloXs.cpp

index 1196e7b303d9f6e37a1f69cf4f5a7f55c5878b64..5a495d5f363196e85eaf11f27bc1217ef21f2e2c 100644 (file)
@@ -49,9 +49,6 @@ template<typename T> ObjectDetectionResult &HailoYoloXs<T>::result()
 
        ObjectDetection<T>::getOutputNames(names);
 
-       for (auto &name : names)
-               LOGD("output tensor name : %s", name.c_str());
-
        vector<float> output_tensor;
 
        // output layer name is yolov10s/yolov8_nms_postprocess
@@ -60,17 +57,8 @@ template<typename T> ObjectDetectionResult &HailoYoloXs<T>::result()
        auto scoreMetaInfo = _config->getOutputMetaMap().at(names[0]);
        auto decodingScore = static_pointer_cast<DecodingScore>(scoreMetaInfo->decodingTypeMap[DecodingType::SCORE]);
 
-       LOGD("threshold = %f", decodingScore->threshold);
-
        auto ori_src_width = static_cast<float>(_preprocess.getImageWidth()[0]);
        auto ori_src_height = static_cast<float>(_preprocess.getImageHeight()[0]);
-       auto input_tensor_width = static_cast<float>(_inference->getInputWidth());
-       auto input_tensor_height = static_cast<float>(_inference->getInputHeight());
-
-       // Calculates the width and height ratios between the original source dimensions and the input tensor dimensions.
-       auto width_ratio = ori_src_width / input_tensor_width;
-       auto height_ratio = ori_src_height / input_tensor_height;
-
        unsigned int class_id = 0;
        size_t tensor_idx = 0;
 
@@ -91,10 +79,10 @@ template<typename T> ObjectDetectionResult &HailoYoloXs<T>::result()
                        // Calculates the coordinates of a bounding box from the output tensor values.
                        // - It computes the top, left, bottom, and right coordinates of a bounding box
                        //   based on the given output tensor values and scaling factors for height and width.
-                       top = height_ratio * input_tensor_height * output_tensor[tensor_idx++];
-                       left = width_ratio * input_tensor_width * output_tensor[tensor_idx++];
-                       bottom = height_ratio * input_tensor_height * output_tensor[tensor_idx++];
-                       right = width_ratio * input_tensor_width * output_tensor[tensor_idx++];
+                       top = ori_src_height * output_tensor[tensor_idx++];
+                       left = ori_src_width * output_tensor[tensor_idx++];
+                       bottom = ori_src_height * output_tensor[tensor_idx++];
+                       right = ori_src_width * output_tensor[tensor_idx++];
                        confidence = output_tensor[tensor_idx++];
                        if (confidence < decodingScore->threshold)
                                continue;