-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathtensorflow_tinyyolo.sh
42 lines (31 loc) · 1.13 KB
/
tensorflow_tinyyolo.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
REDIS_CLI=redis-cli
MODEL_FILE=../models/tensorflow/tinyyolo/tinyyolo.pb
SCRIPT_FILE=../models/tensorflow/tinyyolo/yolo_boxes_script.py
INPUT_VAR=input
OUTPUT_VAR=output
MODEL_KEY=yolo
SCRIPT_KEY=yolo_script
FN_NAME=boxes_from_tf
INPUT_KEY=image
MODEL_OUTPUT=model_output
SCRIPT_OUTPUT=script_output
IMAGE_FILE=../data/sample_dog_224.raw
IMAGE_WIDTH=224
IMAGE_HEIGHT=224
echo "SET MODEL"
$REDIS_CLI -x AI.MODELSET $MODEL_KEY TF CPU INPUTS $INPUT_VAR OUTPUTS $OUTPUT_VAR BLOB< $MODEL_FILE
echo "SET SCRIPT"
$REDIS_CLI -x AI.SCRIPTSET $SCRIPT_KEY CPU SOURCE< $SCRIPT_FILE
echo "SET TENSOR"
$REDIS_CLI -x AI.TENSORSET $INPUT_KEY FLOAT 1 $IMAGE_WIDTH $IMAGE_HEIGHT 3 BLOB < $IMAGE_FILE
echo "GET TENSOR"
$REDIS_CLI AI.TENSORGET $INPUT_KEY META
echo "RUN MODEL"
$REDIS_CLI AI.MODELRUN $MODEL_KEY INPUTS $INPUT_KEY OUTPUTS $MODEL_OUTPUT
echo "RUN SCRIPT"
$REDIS_CLI AI.SCRIPTRUN $SCRIPT_KEY $FN_NAME INPUTS $MODEL_OUTPUT OUTPUTS $SCRIPT_OUTPUT
echo "GET OUTPUT META"
$REDIS_CLI AI.TENSORGET $SCRIPT_OUTPUT META
# echo "GET OUTPUT VALUE"
# $REDIS_CLI AI.TENSORGET $SCRIPT_OUTPUT VALUES # A LONG LIST
$REDIS_CLI DEL ${MODEL_KEY} ${INPUT_KEY} ${OUTPUT_KEY}