From e3b62d61b28638f04838f64461e271d07f47f259 Mon Sep 17 00:00:00 2001 From: Sean McBride Date: Wed, 10 Mar 2021 08:49:04 -0500 Subject: [PATCH 1/3] chore: add speechtotext submodule --- .gitmodules | 28 ++++++++++++++++------------ runtime/tests/speechtotext | 1 + 2 files changed, 17 insertions(+), 12 deletions(-) create mode 160000 runtime/tests/speechtotext diff --git a/.gitmodules b/.gitmodules index 71702a4..5d1119b 100644 --- a/.gitmodules +++ b/.gitmodules @@ -12,18 +12,22 @@ url = https://github.com/gwsystems/ck.git path = runtime/thirdparty/jsmn url = https://github.com/gwsystems/jsmn.git [submodule "runtime/tests/gocr"] - path = runtime/tests/gocr - url = https://github.com/gwsystems/gocr.git - branch = sledge +path = runtime/tests/gocr +url = https://github.com/gwsystems/gocr.git +branch = sledge [submodule "runtime/tests/TinyEKF"] - path = runtime/tests/TinyEKF - url = https://github.com/gwsystems/TinyEKF.git - branch = sledge +path = runtime/tests/TinyEKF +url = https://github.com/gwsystems/TinyEKF.git +branch = sledge [submodule "runtime/tests/CMSIS_5_NN"] - path = runtime/tests/CMSIS_5_NN - url = https://github.com/gwsystems/CMSIS_5_NN.git - branch = sledge +path = runtime/tests/CMSIS_5_NN +url = https://github.com/gwsystems/CMSIS_5_NN.git +branch = sledge [submodule "runtime/tests/sod"] - path = runtime/tests/sod - url = https://github.com/gwsystems/sod.git - branch = sledge \ No newline at end of file +path = runtime/tests/sod +url = https://github.com/gwsystems/sod.git +branch = sledge +[submodule "runtime/tests/speechtotext"] +path = runtime/tests/speechtotext +url = https://github.com/gwsystems/speechtotext.git +branch = sledge diff --git a/runtime/tests/speechtotext b/runtime/tests/speechtotext new file mode 160000 index 0000000..95964ee --- /dev/null +++ b/runtime/tests/speechtotext @@ -0,0 +1 @@ +Subproject commit 95964ee0d6f95a2068f8ea98a798c0a9fbc9b919 From e895d3fed9fdc7a64596accb5e3b8f688f67e113 Mon Sep 17 00:00:00 2001 From: Sean McBride Date: Wed, 10 Mar 2021 12:07:55 -0500 Subject: [PATCH 2/3] feat: WIP speech to text --- .../applications/speechtotext/.gitignore | 1 + .../applications/speechtotext/run.sh | 59 +++++++++++++++++++ .../applications/speechtotext/spec.json | 14 +++++ runtime/tests/speechtotext | 2 +- 4 files changed, 75 insertions(+), 1 deletion(-) create mode 100644 runtime/experiments/applications/speechtotext/.gitignore create mode 100755 runtime/experiments/applications/speechtotext/run.sh create mode 100644 runtime/experiments/applications/speechtotext/spec.json diff --git a/runtime/experiments/applications/speechtotext/.gitignore b/runtime/experiments/applications/speechtotext/.gitignore new file mode 100644 index 0000000..81154dd --- /dev/null +++ b/runtime/experiments/applications/speechtotext/.gitignore @@ -0,0 +1 @@ +samples diff --git a/runtime/experiments/applications/speechtotext/run.sh b/runtime/experiments/applications/speechtotext/run.sh new file mode 100755 index 0000000..0fd1bc4 --- /dev/null +++ b/runtime/experiments/applications/speechtotext/run.sh @@ -0,0 +1,59 @@ +#!/bin/bash +# Executes the runtime in GDB +# Substitutes the absolute path from the container with a path relatively derived from the location of this script +# This allows debugging outside of the Docker container +# Also disables pagination and stopping on SIGUSR1 + +experiment_directory=$(pwd) +project_directory=$(cd ../../.. && pwd) +binary_directory=$(cd "$project_directory"/bin && pwd) + +# Copy License Plate Image if not here +if [[ ! -f "./samples/goforward.raw" ]]; then + cp ../../../tests/speechtotext/goforward.raw ./samples/goforward.raw +fi + +if [ "$1" != "-d" ]; then + PATH="$binary_directory:$PATH" LD_LIBRARY_PATH="$binary_directory:$LD_LIBRARY_PATH" sledgert "$experiment_directory/spec.json" & + sleep 1 +else + echo "Running under gdb" +fi + +curl -H 'Expect:' -H "Content-Type: image/jpg" --data-binary "@samples/goforward.raw" localhost:10000 2>/dev/null + +exit +# WIP - Need to cleanup below + +expected_size="$(find expected_result.jpg -printf "%s")" +success_count=0 +total_count=50 + +for ((i = 0; i < total_count; i++)); do + echo "$i" + ext="$RANDOM" + curl -H 'Expect:' -H "Content-Type: image/jpg" --data-binary "@plate.jpg" --output "result_$ext.jpg" localhost:10000 2>/dev/null + actual_size="$(find result_"$ext".jpg -printf "%s")" + + # echo "$result" + if [[ "$expected_size" == "$actual_size" ]]; then + echo "SUCCESS $success_count" + else + echo "FAIL" + echo "Expected Size:" + echo "$expected_size" + echo "===============================================" + echo "Actual Size:" + echo "$actual_size" + fi +done + +echo "$success_count / $total_count" + +if [ "$1" != "-d" ]; then + sleep 5 + echo -n "Running Cleanup: " + rm result_*.jpg + pkill sledgert >/dev/null 2>/dev/null + echo "[DONE]" +fi diff --git a/runtime/experiments/applications/speechtotext/spec.json b/runtime/experiments/applications/speechtotext/spec.json new file mode 100644 index 0000000..30b122d --- /dev/null +++ b/runtime/experiments/applications/speechtotext/spec.json @@ -0,0 +1,14 @@ +{ + "active": "yes", + "name": "hello_ps", + "path": "hello_ps_wasm.so", + "port": 10000, + "relative-deadline-us": 50000, + "argsize": 1, + "http-req-headers": [], + "http-req-content-type": "image/jpeg", + "http-req-size": 102400, + "http-resp-headers": [], + "http-resp-size": 1048576, + "http-resp-content-type": "image/jpeg" +} diff --git a/runtime/tests/speechtotext b/runtime/tests/speechtotext index 95964ee..9be33ca 160000 --- a/runtime/tests/speechtotext +++ b/runtime/tests/speechtotext @@ -1 +1 @@ -Subproject commit 95964ee0d6f95a2068f8ea98a798c0a9fbc9b919 +Subproject commit 9be33cac8e14bf3c0d647759ef6e68739ae624f5 From 2f9b72bdc2e9dda02afb3e04dd81479332dda082 Mon Sep 17 00:00:00 2001 From: Sean McBride Date: Mon, 15 Mar 2021 22:43:07 -0400 Subject: [PATCH 3/3] chore: Improve testing --- .../applications/speechtotext/debug.sh | 19 ++++++++++ .../applications/speechtotext/run.sh | 36 ++++++++----------- runtime/tests/speechtotext | 2 +- 3 files changed, 35 insertions(+), 22 deletions(-) create mode 100755 runtime/experiments/applications/speechtotext/debug.sh diff --git a/runtime/experiments/applications/speechtotext/debug.sh b/runtime/experiments/applications/speechtotext/debug.sh new file mode 100755 index 0000000..a561392 --- /dev/null +++ b/runtime/experiments/applications/speechtotext/debug.sh @@ -0,0 +1,19 @@ +#!/bin/bash +# Executes the runtime in GDB +# Substitutes the absolute path from the container with a path relatively derived from the location of this script +# This allows debugging outside of the Docker container +# Also disables pagination and stopping on SIGUSR1 + +experiment_directory=$(pwd) +project_directory=$(cd ../../.. && pwd) +binary_directory=$(cd "$project_directory"/bin && pwd) + +export LD_LIBRARY_PATH="$binary_directory:$LD_LIBRARY_PATH" +export PATH="$binary_directory:$PATH" + +gdb --eval-command="handle SIGUSR1 nostop" \ + --eval-command="handle SIGPIPE nostop" \ + --eval-command="set pagination off" \ + --eval-command="set substitute-path /sledge/runtime $project_directory" \ + --eval-command="run $experiment_directory/spec.json" \ + sledgert diff --git a/runtime/experiments/applications/speechtotext/run.sh b/runtime/experiments/applications/speechtotext/run.sh index 0fd1bc4..732089e 100755 --- a/runtime/experiments/applications/speechtotext/run.sh +++ b/runtime/experiments/applications/speechtotext/run.sh @@ -20,32 +20,26 @@ else echo "Running under gdb" fi -curl -H 'Expect:' -H "Content-Type: image/jpg" --data-binary "@samples/goforward.raw" localhost:10000 2>/dev/null - -exit -# WIP - Need to cleanup below - -expected_size="$(find expected_result.jpg -printf "%s")" +# expected_size="$(find expected_result.jpg -printf "%s")" success_count=0 total_count=50 for ((i = 0; i < total_count; i++)); do echo "$i" - ext="$RANDOM" - curl -H 'Expect:' -H "Content-Type: image/jpg" --data-binary "@plate.jpg" --output "result_$ext.jpg" localhost:10000 2>/dev/null - actual_size="$(find result_"$ext".jpg -printf "%s")" - - # echo "$result" - if [[ "$expected_size" == "$actual_size" ]]; then - echo "SUCCESS $success_count" - else - echo "FAIL" - echo "Expected Size:" - echo "$expected_size" - echo "===============================================" - echo "Actual Size:" - echo "$actual_size" - fi + # ext="$RANDOM" + curl -H 'Expect:' -H "Content-Type: image/jpg" --data-binary "@goforward.raw" localhost:10000 2>/dev/null + + # # echo "$result" + # if [[ "$expected_size" == "$actual_size" ]]; then + # echo "SUCCESS $success_count" + # else + # echo "FAIL" + # echo "Expected Size:" + # echo "$expected_size" + # echo "===============================================" + # echo "Actual Size:" + # echo "$actual_size" + # fi done echo "$success_count / $total_count" diff --git a/runtime/tests/speechtotext b/runtime/tests/speechtotext index 9be33ca..859db01 160000 --- a/runtime/tests/speechtotext +++ b/runtime/tests/speechtotext @@ -1 +1 @@ -Subproject commit 9be33cac8e14bf3c0d647759ef6e68739ae624f5 +Subproject commit 859db012144cbcec0cfccaedea4bee45ae50776f