Code clean up 55/283155/6 accepted/tizen_7.0_unified tizen_7.0 accepted/tizen/7.0/unified/20221103.165408 accepted/tizen/7.0/unified/20221110.063616 accepted/tizen/unified/20221103.165727 accepted/tizen/unified/20230113.091233
authorHyunsoo Park <hance.park@samsung.com>
Wed, 19 Oct 2022 06:26:36 +0000 (15:26 +0900)
committerHyunsoo Park <hance.park@samsung.com>
Thu, 20 Oct 2022 06:09:13 +0000 (15:09 +0900)
- Add macro 'TENSOR_SIZE'
- Modify scanf defect

[Version] : 0.4.6
[Issue type] : bug fix

Change-Id: Idf3b8d48c0813325215cb99fcd7e38f95fb97eaa
Signed-off-by: Hyunsoo Park <hance.park@samsung.com>
packaging/inference-engine-interface.spec
test/src/inference_engine_test_common.cpp
tools/src/inference_engine_cltuner.cpp

index 98889ba..dc74be5 100644 (file)
@@ -1,6 +1,6 @@
 Name:        inference-engine-interface
 Summary:     Interface of inference engines
-Version:     0.4.5
+Version:     0.4.6
 Release:     0
 Group:       Multimedia/Framework
 License:     Apache-2.0
index 28c9c79..0a4526a 100644 (file)
@@ -33,7 +33,7 @@
 // TODO. Below device tree file is not available on TM1 board.
 //              So find another way to get Machine ID.
 #define MACHINE_MODEL_PATH     "/sys/firmware/devicetree/base/model"
-
+#define TENSOR_SIZE 4
 static std::map<std::string, int> Model_Formats = {
        { "caffemodel", INFERENCE_MODEL_CAFFE }, { "pb", INFERENCE_MODEL_TF },
        { "tflite", INFERENCE_MODEL_TFLITE },   { "t7", INFERENCE_MODEL_TORCH },
@@ -570,8 +570,8 @@ int VerifyAICHandGesture2Results(IETensorBuffer &output,
        // data type   : float
        // tensor shape : 1 * 21 * 2
        std::string outputNameCoord("mobilenetv2/coord_refine");
-       size_t size = output[outputNameCoord].size / 4;
-       for (size_t i = 0; i < size; ++i) {
+       size_t count = output[outputNameCoord].size / TENSOR_SIZE;
+       for (size_t i = 0; i < count; ++i) {
                unsigned int value = static_cast<unsigned int>(static_cast<float *>(output[outputNameCoord].buffer)[i] * 100.0f);
                if (value != static_cast<unsigned int>(answers[i])) {
                        std::cout << "coord_refine wrong answer at index[" << i << "]" << std::endl;
index 678faf5..5c81450 100644 (file)
@@ -563,7 +563,7 @@ int main()
        show_menu("CLtuner Generator");
 
        char mode[MAX_STR];
-       int ret = scanf("%s", mode);
+       int ret = scanf("%2s", mode);
 
        if (strncmp(mode, "q", 1) == 0) {
                g_print("exit!\n");
@@ -572,7 +572,7 @@ int main()
 
        char file_path[MAX_STR];
 
-       ret = scanf("%s", file_path);
+       ret = scanf("%255s", file_path);
        if (ret == 0) {
                g_print("wrong input.\n");
                return -1;