diff options
author | Inki Dae <inki.dae@samsung.com> | 2024-02-01 15:08:33 +0900 |
---|---|---|
committer | Inki Dae <inki.dae@samsung.com> | 2024-02-05 13:03:47 +0900 |
commit | 0ffb994cac2dc84ed38ced38e6a360ca7db152e2 (patch) | |
tree | 952319f363bfb335091e68222346e9afc733ec14 /test/testsuites/machine_learning/image_classification | |
parent | aaf099a6b4ff1448151e06682d579f686db158f9 (diff) | |
download | mediavision-0ffb994cac2dc84ed38ced38e6a360ca7db152e2.tar.gz mediavision-0ffb994cac2dc84ed38ced38e6a360ca7db152e2.tar.bz2 mediavision-0ffb994cac2dc84ed38ced38e6a360ca7db152e2.zip |
mv_machine_learning: use explicit API name and code cleanup
[Issue type] : code cleanup
Use explicit result API name for task group API to make it easier for users
to understand what kind of information they will receive from the Task Group
API. In addition, this patch cleans up test code for each task group by
dropping console output and unnecessary parameters from task group API and
its test case code.
Change-Id: I3194c50e3b712640034ccd7437c408fb5a6679ab
Signed-off-by: Inki Dae <inki.dae@samsung.com>
Diffstat (limited to 'test/testsuites/machine_learning/image_classification')
-rw-r--r-- | test/testsuites/machine_learning/image_classification/test_image_classification.cpp | 6 | ||||
-rw-r--r-- | test/testsuites/machine_learning/image_classification/test_image_classification_async.cpp | 13 |
2 files changed, 5 insertions, 14 deletions
diff --git a/test/testsuites/machine_learning/image_classification/test_image_classification.cpp b/test/testsuites/machine_learning/image_classification/test_image_classification.cpp index 33ffa2c3..aa14b2b8 100644 --- a/test/testsuites/machine_learning/image_classification/test_image_classification.cpp +++ b/test/testsuites/machine_learning/image_classification/test_image_classification.cpp @@ -88,7 +88,7 @@ TEST(ImageClassificationTest, InferenceShouldBeOk) mv_image_classification_h handle; vector<model_info> test_models { - { "", "", "" }, // If empty then default model will be used. + {}, // If empty then default model will be used. { "quant_mobilenet_v1_224x224.tflite", "quant_mobilenet_v1_224x224.json", "ic_mobilenet_v1_label.txt" }, { "image-classification-001.tflite", "image-classification-001.json", "image-classification-label.txt" }, { "ic_squeezenet_224x224.tflite", "ic_squeezenet_224x224.json", "ic_squeezenet_label.txt" }, @@ -109,8 +109,6 @@ TEST(ImageClassificationTest, InferenceShouldBeOk) ASSERT_EQ(ret, MEDIA_VISION_ERROR_NONE); for (const auto &model : test_models) { - cout << "model name : " << model.model_file << endl; - ret = mv_image_classification_create(&handle); ASSERT_EQ(ret, MEDIA_VISION_ERROR_NONE); @@ -139,7 +137,7 @@ TEST(ImageClassificationTest, InferenceShouldBeOk) for (unsigned long idx = 0; idx < cnt; ++idx) { const char *label = NULL; - ret = mv_image_classification_get_result(handle, idx, &label); + ret = mv_image_classification_get_label(handle, idx, &label); ASSERT_EQ(ret, MEDIA_VISION_ERROR_NONE); cout << "frame number = " << frame_number << " label = " << label << endl; diff --git a/test/testsuites/machine_learning/image_classification/test_image_classification_async.cpp b/test/testsuites/machine_learning/image_classification/test_image_classification_async.cpp index e56df025..32330d1d 100644 --- a/test/testsuites/machine_learning/image_classification/test_image_classification_async.cpp +++ b/test/testsuites/machine_learning/image_classification/test_image_classification_async.cpp @@ -57,15 +57,12 @@ void image_classification_callback(void *user_data) for (unsigned long idx = 0; idx < cnt; ++idx) { const char *label = NULL; - ret = mv_image_classification_get_result(handle, idx, &label); + ret = mv_image_classification_get_label(handle, idx, &label); ASSERT_EQ(ret, MEDIA_VISION_ERROR_NONE); if (frame_number > MAX_INFERENCE_ITERATION - 10) is_loop_exit = true; - cout << "Expected label = BANANA" - << " Actual label = " << label << endl; - string label_str(label); transform(label_str.begin(), label_str.end(), label_str.begin(), ::toupper); @@ -79,7 +76,7 @@ TEST(ImageClassificationAsyncTest, InferenceShouldBeOk) { mv_image_classification_h handle; vector<model_info> test_models { - { "", "", "" }, // If empty then default model will be used. + {}, // If empty then default model will be used. { "quant_mobilenet_v1_224x224.tflite", "quant_mobilenet_v1_224x224.json", "ic_mobilenet_v1_label.txt" }, { "image-classification-001.tflite", "image-classification-001.json", "image-classification-label.txt" }, { "ic_nasnet_224x224.tflite", "ic_nasnet_224x224.json", "ic_nasnet_label.txt" }, @@ -93,8 +90,6 @@ TEST(ImageClassificationAsyncTest, InferenceShouldBeOk) int ret = mv_image_classification_create(&handle); ASSERT_EQ(ret, MEDIA_VISION_ERROR_NONE); - cout << "model name : " << model.model_file << endl; - ret = mv_image_classification_set_model(handle, model.model_file.c_str(), model.meta_file.c_str(), model.label_file.c_str()); ASSERT_EQ(ret, MEDIA_VISION_ERROR_NONE); @@ -141,7 +136,7 @@ TEST(ImageClassificationAsyncTest, InferenceShouldBeOkWithDestroyFirst) { mv_image_classification_h handle; vector<model_info> test_models { - { "", "", "" }, // If empty then default model will be used. + {}, // If empty then default model will be used. { "quant_mobilenet_v1_224x224.tflite", "quant_mobilenet_v1_224x224.json", "ic_mobilenet_v1_label.txt" }, { "image-classification-001.tflite", "image-classification-001.json", "image-classification-label.txt" }, { "ic_nasnet_224x224.tflite", "ic_nasnet_224x224.json", "ic_nasnet_label.txt" }, @@ -155,8 +150,6 @@ TEST(ImageClassificationAsyncTest, InferenceShouldBeOkWithDestroyFirst) int ret = mv_image_classification_create(&handle); ASSERT_EQ(ret, MEDIA_VISION_ERROR_NONE); - cout << "model name : " << model.model_file << endl; - ret = mv_image_classification_set_model(handle, model.model_file.c_str(), model.meta_file.c_str(), model.label_file.c_str()); ASSERT_EQ(ret, MEDIA_VISION_ERROR_NONE); |