55# see provided installation scripts
66set -eu
77
8- ENTRY_CMD=$1
9- TESTDATA_DIR=$2
10- DEVICE=$3
8+ usage () {
9+ echo " Usage: $0 --command <command> --testdata <path> --device <device>"
10+ echo " "
11+ echo " Runs evaluation for vision performances with SAM."
12+ echo " "
13+ echo " Options:"
14+ echo " -c, --command Entrypoint command. Options: compressai-split-inference, compressai-remote-inference"
15+ echo " -t, --testdata Path to the test data directory (e.g., /path/to/COCODataset/)."
16+ echo " -d, --device Device to use for evaluation (e.g., cuda:0)."
17+ echo " -h, --help Display this help message."
18+ exit 1
19+ }
20+
21+ # Parse arguments
22+ while [[ $# -gt 0 ]]; do
23+ key=" $1 "
24+ case $key in
25+ -c|--command) shift ; ENTRY_CMD=" $1 " ; shift ; ;;
26+ -t|--testdata) shift ; TESTDATA_DIR=" $1 " ; shift ; ;;
27+ -d|--device) shift ; DEVICE=" $1 " ; shift ; ;;
28+ -h|--help) usage;;
29+ * ) echo " [ERROR] Unknown parameter $1 " ; usage; exit ; ;;
30+ esac
31+ done
32+
33+ # Check if mandatory arguments are provided
34+ if [ -z " ${ENTRY_CMD-} " ] || [ -z " ${TESTDATA_DIR-} " ] || [ -z " ${DEVICE-} " ]; then
35+ echo " Error: Missing mandatory arguments."
36+ usage
37+ fi
1138
1239# List of entry cmds
13- CMD_OPTS=(" compressai-split-inference" , " compressai-remote-inference" )
40+ CMD_OPTS=(" compressai-split-inference" " compressai-remote-inference" )
1441
15- if [[ " ${CMD_OPTS[@]} " =~ ${ENTRY_CMD} ]]; then
42+ if [[ " ${CMD_OPTS[@]} " =~ " ${ENTRY_CMD} " ]]; then
1643 echo " Run ${ENTRY_CMD} ........"
1744else
18- echo : " ${ENTRY_CMD} does not exist in the options."
19- echo : " Please choose one out of these options: ${CMD_OPTS[@ ]} "
45+ echo " : ${ENTRY_CMD} does not exist in the options."
46+ echo " : Please choose one out of these options: ${CMD_OPTS[* ]} "
2047 exit 1
2148fi
2249
@@ -27,12 +54,9 @@ configs["compressai-remote-inference"]="eval_remote_inference_example"
2754
2855CONF_NAME=${configs[${ENTRY_CMD}]}
2956
30- if [ $# == 2 ]; then
31- TESTDATA_DIR=$2
32- fi
3357if [ ! -d " ${TESTDATA_DIR} " ]; then
3458 echo " ${TESTDATA_DIR} does not exist, please select dataset folder, e.g.
35- $ bash default_vision_performances.sh [etnry_cmd] [/path/to/dataset]"
59+ $ bash default_vision_performances.sh --command [entry_cmd] --testdata [/path/to/dataset] --device [device ]"
3660 exit
3761fi
3862
0 commit comments