From 13e123eb104ceadc377ee32be2a96bb574c08d94 Mon Sep 17 00:00:00 2001 From: cam Date: Sat, 8 Oct 2016 14:48:35 -0600 Subject: First commit --- stylize_image.sh | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 stylize_image.sh (limited to 'stylize_image.sh') diff --git a/stylize_image.sh b/stylize_image.sh new file mode 100644 index 0000000..7c6f021 --- /dev/null +++ b/stylize_image.sh @@ -0,0 +1,43 @@ +set -e +# Get a carriage return into `cr` +cr=`echo $'\n.'` +cr=${cr%.} + +if [ "$#" -le 1 ]; then + echo "Usage: bash stylize_image.sh " + exit 1 +fi + +echo "" +read -p "Did you install the required dependencies? [y/n] $cr > " dependencies + +if [ "$dependencies" != "y" ]; then + echo "Error: Requires dependencies: tensorflow, opencv2 (python), scipy" + exit 1; +fi + +echo "" +read -p "Do you have a CUDA enabled GPU? [y/n] $cr > " cuda + +if [ "$cuda" != "y" ]; then + device='/cpu:0' +else + device='/gpu:0' +fi + +# Parse arguments +content_image="$1" +content_dir=$(dirname "$content_image") +content_filename=$(basename "$content_image") + +style_image="$2" +style_dir=$(dirname "$style_image" ) +style_filename=$(basename "$style_image") + +echo "Rendering stylized image. This may take a while..." +python neural_style.py \ +--content_img "${content_filename}" \ +--content_img_dir "${content_dir}" \ +--style_imgs "${style_filename}" \ +--style_imgs_dir "${style_dir}" \ +--device "${device}"; \ No newline at end of file -- cgit v1.2.3-70-g09d2