blob: 2b94573ae950299cca632c2a0f4d4a6f4f5375a7 [file] [log] [blame]
#!/bin/bash
readonly TEST_DATA="/usr/share/edgetpudemo"
readonly VIDEO_DEVICE_FILE="${TEST_DATA}/video_device.mp4"
readonly VIDEO_STREAM_FILE="${TEST_DATA}/video_stream.mp4"
readonly TPU_MODEL_FILE="${TEST_DATA}/mobilenet_ssd_v1_coco_quant_postprocess_edgetpu.tflite@Running MobileNet SSD v1 on Edge TPU"
readonly CPU_MODEL_FILE="${TEST_DATA}/mobilenet_ssd_v1_coco_quant_postprocess.tflite@Running MobileNet SSD v1 on CPU"
readonly LABELS_FILE="${TEST_DATA}/coco_labels.txt"
if [[ "$1" == "--device" ]]; then
echo "Press 'q' to quit."
echo "Press 'n' to switch between models."
#TODO: Add looping back once codec EOS is fixed.
edgetpu_detect \
--source "${VIDEO_DEVICE_FILE}" \
--model "${TPU_MODEL_FILE},${CPU_MODEL_FILE}" \
--labels "${LABELS_FILE}" \
--filter car,truck \
--max_area 0.1 \
--color white \
--loop \
--displaymode fullscreen
elif [[ "$1" == "--stream" ]]; then
echo "Press 'q' to quit."
echo "Press 'n' to switch between models."
SERVER_INDEX_HTML="${TEST_DATA}/index.html" edgetpu_detect_server \
--source "${VIDEO_STREAM_FILE}" \
--model "${TPU_MODEL_FILE},${CPU_MODEL_FILE}" \
--labels "${LABELS_FILE}" \
--filter car,truck \
--max_area 0.1 \
--color white \
--loop
else
echo "Run on-device inference:"
echo " $0 --device"
echo "Run streaming server:"
echo " $0 --stream"
fi