Created
June 2, 2017 00:53
-
-
Save SleepProgger/c4a7239c5a7bec16749f7483b388a3e8 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# | |
# Run this script from the location of ideepcolor.py | |
# | |
# TODO: search for any py 3 version | |
PYTHON="python3" | |
CAFFE_FILES="./caffe_files" | |
MODELS="./models" | |
XLEN=136 | |
COLOR_PROTO="reference_model/deploy_nodist.prototxt" | |
DIST_PROTO="reference_model/deploy_nopred.prototxt" | |
if [ \ | |
-e "${MODELS}/reference_model/model.caffemodel" \ | |
-a -e "${MODELS}/global_model/global_model.caffemodel" \ | |
-a -e "${MODELS}/global_model/dummy.caffemodel" \ | |
]; then | |
echo "Models already available" | |
else | |
echo "Download models" | |
. "${MODELS}/fetch_models.sh" | |
fi; | |
# If we change XLEN we need to copy and update the prototxt input layer dimensions. | |
# This is quite dirty but it does get the job done. | |
PARAMS="" | |
if [ "$XLEN" != "256" ]; then | |
PARAMS="--load_size $XLEN" | |
PROTO_NAME="${MODELS}/${COLOR_PROTO}_${XLEN}" | |
if [ ! -e "$PROTO_NAME" ]; then | |
cp "${MODELS}/${COLOR_PROTO}" "$PROTO_NAME" | |
sed -i "s/\(input_param { shape { dim: 1 dim: 4 dim: \)256\( dim: \)256\( } }\)/\1${XLEN}\2${XLEN}\3/" \ | |
"${PROTO_NAME}" | |
fi | |
PARAMS="$PARAMS --color_prototxt ${PROTO_NAME}" | |
PROTO_NAME="${MODELS}/${DIST_PROTO}_${XLEN}" | |
if [ ! -e "$PROTO_NAME" ]; then | |
cp "${MODELS}/${DIST_PROTO}" "$PROTO_NAME" | |
sed -i "s/\(input_param { shape { dim: 1 dim: 4 dim: \)256\( dim: \)256\( } }\)/\1${XLEN}\2${XLEN}\3/" \ | |
"${PROTO_NAME}" | |
fi | |
PARAMS="$PARAMS --dist_prototxt ${PROTO_NAME}" | |
fi | |
PYTHONPATH="${PYTHONPATH}:${CAFFE_FILES}" | |
export PYTHONPATH | |
${PYTHON} ideepcolor.py $* $PARAMS |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
works like a charm