blob: 6c22e6ff6d7fc71ab68e8e2af4258c441491a3ff [file] [log] [blame]
Éanna Ó Catháin919c14e2020-09-14 17:36:49 +01001//
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
10const std::string MODEL_NAME = "--model-name";
11const std::string VIDEO_FILE_PATH = "--video-file-path";
12const std::string MODEL_FILE_PATH = "--model-file-path";
13const std::string OUTPUT_VIDEO_FILE_PATH = "--output-video-file-path";
14const std::string LABEL_PATH = "--label-path";
15const std::string PREFERRED_BACKENDS = "--preferred-backends";
16const std::string HELP = "--help";
17
18/*
19 * The accepted options for this Object detection executable
20 */
21static 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 */
37bool CheckOptionSpecified(const std::map<std::string, std::string>& options, const std::string& option);
38
39
40/*
41 * Retrieves the user provided option
42 */
43std::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 */
49int ParseOptions(std::map<std::string, std::string>& options, std::map<std::string, std::string>& acceptedOptions,
50 char *argv[], int argc);