1 // 2 // Copyright © 2020 Arm Ltd and Contributors. All rights reserved. 3 // SPDX-License-Identifier: MIT 4 // 5 #pragma once 6 #include <string> 7 #include <map> 8 #include <iostream> 9 10 const std::string MODEL_NAME = "--model-name"; 11 const std::string VIDEO_FILE_PATH = "--video-file-path"; 12 const std::string MODEL_FILE_PATH = "--model-file-path"; 13 const std::string OUTPUT_VIDEO_FILE_PATH = "--output-video-file-path"; 14 const std::string LABEL_PATH = "--label-path"; 15 const std::string PREFERRED_BACKENDS = "--preferred-backends"; 16 const std::string HELP = "--help"; 17 18 /* 19 * The accepted options for this Object detection executable 20 */ 21 static std::map<std::string, std::string> CMD_OPTIONS = { 22 {VIDEO_FILE_PATH, "[REQUIRED] Path to the video file to run object detection on"}, 23 {MODEL_FILE_PATH, "[REQUIRED] Path to the Object Detection model to use"}, 24 {LABEL_PATH, "[REQUIRED] Path to the label set for the provided model file. " 25 "Label file is should just be an ordered list, seperated by new line."}, 26 {MODEL_NAME, "[REQUIRED] The name of the model being used. Accepted options: YOLO_V3_TINY, SSD_MOBILE"}, 27 {OUTPUT_VIDEO_FILE_PATH, "[OPTIONAL] Path to the output video file with detections added in. " 28 "If specified will save file to disk, else displays the output to screen"}, 29 {PREFERRED_BACKENDS, "[OPTIONAL] Takes the preferred backends in preference order, separated by comma." 30 " For example: CpuAcc,GpuAcc,CpuRef. Accepted options: [CpuAcc, CpuRef, GpuAcc]." 31 " Defaults to CpuAcc,CpuRef"} 32 }; 33 34 /* 35 * Checks that a particular option was specified by the user 36 */ 37 bool CheckOptionSpecified(const std::map<std::string, std::string>& options, const std::string& option); 38 39 40 /* 41 * Retrieves the user provided option 42 */ 43 std::string GetSpecifiedOption(const std::map<std::string, std::string>& options, const std::string& option); 44 45 46 /* 47 * Parses all the command line options provided by the user and stores in a map. 48 */ 49 int ParseOptions(std::map<std::string, std::string>& options, std::map<std::string, std::string>& acceptedOptions, 50 char *argv[], int argc);