-
Notifications
You must be signed in to change notification settings - Fork 447
/
predict
executable file
·47 lines (41 loc) · 901 Bytes
/
predict
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
43
44
45
46
47
#!/bin/bash
set -e
# parse arguments
POSITIONAL=()
while [[ $# -gt 0 ]]
do
key="$1"
case $key in
--docker-image)
DOCKER_IMAGE="$2"
shift # past argument
shift # past value
;;
--base-model-name)
BASE_MODEL_NAME="$2"
shift # past argument
shift # past value
;;
--weights-file)
WEIGHTS_FILE="$2"
shift # past argument
shift # past value
;;
--image-source)
IMAGE_SOURCE="$2"
shift # past argument
;;
*) # unknown option
POSITIONAL+=("$1") # save it in an array for later
shift # past argument
;;
esac
done
BASENAME_IS=`basename $IMAGE_SOURCE`
# run predictions
DOCKER_RUN="docker run
--entrypoint entrypoints/entrypoint.predict.cpu.sh \
-v "$IMAGE_SOURCE":/src/$BASENAME_IS
-v "$WEIGHTS_FILE":/src/weights.hdf5
$DOCKER_IMAGE $BASE_MODEL_NAME /src/weights.hdf5 /src/$BASENAME_IS"
eval $DOCKER_RUN