summaryrefslogtreecommitdiff
path: root/source/use_case/img_class/src/MainLoop.cc
diff options
context:
space:
mode:
authorÉanna Ó Catháin <eanna.ocathain@arm.com>2021-09-15 09:32:30 +0100
committerKshitij Sisodia <kshitij.sisodia@arm.com>2021-09-16 16:01:23 +0100
commit8f9588721cbb7356b03a714c97d6b3a9a6e89438 (patch)
tree1ca19d31958081c09f360d91e15fefb6e38b3992 /source/use_case/img_class/src/MainLoop.cc
parente6588f620c648dd0492f6133152855d77c672568 (diff)
downloadml-embedded-evaluation-kit-8f9588721cbb7356b03a714c97d6b3a9a6e89438.tar.gz
MLECO-2082: Adding visual wake word use case21.08
MLECO-2083: Refactoring img_class and visual wake word *Added source files for visual wake word *Added tests *Added docs *Added new images for visual wake word demo *Refactored common functions in img_class, visual wake word and other usecases Change-Id: Ibd25854e19a5517f940a8d3086a5d4835fab89e9 Signed-off-by: Éanna Ó Catháin <eanna.ocathain@arm.com>
Diffstat (limited to 'source/use_case/img_class/src/MainLoop.cc')
-rw-r--r--source/use_case/img_class/src/MainLoop.cc37
1 files changed, 7 insertions, 30 deletions
diff --git a/source/use_case/img_class/src/MainLoop.cc b/source/use_case/img_class/src/MainLoop.cc
index 61a09dd..79f6018 100644
--- a/source/use_case/img_class/src/MainLoop.cc
+++ b/source/use_case/img_class/src/MainLoop.cc
@@ -24,29 +24,6 @@
using ImgClassClassifier = arm::app::Classifier;
-enum opcodes
-{
- MENU_OPT_RUN_INF_NEXT = 1, /* Run on next vector. */
- MENU_OPT_RUN_INF_CHOSEN, /* Run on a user provided vector index. */
- MENU_OPT_RUN_INF_ALL, /* Run inference on all. */
- MENU_OPT_SHOW_MODEL_INFO, /* Show model info. */
- MENU_OPT_LIST_IMAGES /* List the current baked images. */
-};
-
-static void DisplayMenu()
-{
- printf("\n\n");
- printf("User input required\n");
- printf("Enter option number from:\n\n");
- printf(" %u. Classify next image\n", MENU_OPT_RUN_INF_NEXT);
- printf(" %u. Classify image at chosen index\n", MENU_OPT_RUN_INF_CHOSEN);
- printf(" %u. Run classification on all images\n", MENU_OPT_RUN_INF_ALL);
- printf(" %u. Show NN model info\n", MENU_OPT_SHOW_MODEL_INFO);
- printf(" %u. List images\n\n", MENU_OPT_LIST_IMAGES);
- printf(" Choice: ");
- fflush(stdout);
-}
-
void main_loop(hal_platform& platform)
{
arm::app::MobileNetModel model; /* Model wrapper object. */
@@ -79,29 +56,29 @@ void main_loop(hal_platform& platform)
/* Loop. */
do {
- int menuOption = MENU_OPT_RUN_INF_NEXT;
+ int menuOption = common::MENU_OPT_RUN_INF_NEXT;
if (bUseMenu) {
- DisplayMenu();
+ DisplayCommonMenu();
menuOption = arm::app::ReadUserInputAsInt(platform);
printf("\n");
}
switch (menuOption) {
- case MENU_OPT_RUN_INF_NEXT:
+ case common::MENU_OPT_RUN_INF_NEXT:
executionSuccessful = ClassifyImageHandler(caseContext, caseContext.Get<uint32_t>("imgIndex"), false);
break;
- case MENU_OPT_RUN_INF_CHOSEN: {
+ case common::MENU_OPT_RUN_INF_CHOSEN: {
printf(" Enter the image index [0, %d]: ", NUMBER_OF_FILES-1);
auto imgIndex = static_cast<uint32_t>(arm::app::ReadUserInputAsInt(platform));
executionSuccessful = ClassifyImageHandler(caseContext, imgIndex, false);
break;
}
- case MENU_OPT_RUN_INF_ALL:
+ case common::MENU_OPT_RUN_INF_ALL:
executionSuccessful = ClassifyImageHandler(caseContext, caseContext.Get<uint32_t>("imgIndex"), true);
break;
- case MENU_OPT_SHOW_MODEL_INFO:
+ case common::MENU_OPT_SHOW_MODEL_INFO:
executionSuccessful = model.ShowModelInfoHandler();
break;
- case MENU_OPT_LIST_IMAGES:
+ case common::MENU_OPT_LIST_IFM:
executionSuccessful = ListFilesHandler(caseContext);
break;
default: