Created
March 19, 2018 16:44
-
-
Save jaretburkett/59951dd2c8cd2d7b90ae617107b87211 to your computer and use it in GitHub Desktop.
Deep Dream Zooming Video Bash
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/bash | |
DREAMS=5 | |
#use 6 numbers important | |
ITERATIONS=5 | |
FILE=$1 | |
## Get the file name and path | |
LOCALPATH="$(dirname "$FILE")" | |
LOCALPATHSLASH="$LOCALPATH/" | |
FILENAME=${FILE//$LOCALPATHSLASH/} | |
if [ "$LOCALPATH" == "./" ]; then | |
LOCALPATH="/" | |
fi | |
FILEPATH="$(pwd)/"$LOCALPATH"" | |
echo "Path '$FILEPATH' - Filename '$FILENAME' - Dreams '$DREAMS' - Iterations '$ITERATIONS'" | |
cp -rf "$LOCALPATH/$FILENAME" "$LOCALPATH/MIW-000001-$FILENAME" | |
for COUNTER in $(seq -f "%06g" 1 $((ITERATIONS))); | |
do | |
echo $COUNTER | |
# determine which model to run | |
if [ $((COUNTER%2)) -eq 0 ]; | |
then | |
WHICHNETWORK="googlenet_place205" | |
else | |
WHICHNETWORK="bvlc_googlenet" | |
fi | |
nvidia-docker run --rm -v $(pwd):/deepdreamer -it floydhub/deepdreamer:gpu \ | |
--gpuid 1 \ | |
--network $WHICHNETWORK \ | |
--dreams $DREAMS \ | |
--zoom true \ | |
--scale 0.02 \ | |
"$LOCALPATH/MIW-$COUNTER-$FILENAME" | |
NEXTCOUNT=$(printf "%06d" $(($(($COUNTER))+1))) | |
mv "$LOCALPATH/MIW-$COUNTER-${FILENAME}_$((DREAMS-1)).jpg" "$LOCALPATH/MIW-${NEXTCOUNT}-${FILENAME}" | |
# "$LOCALPATH/MIW-$COUNTER-$FILENAME_$((DREAMS-1)).jpg" | |
# move last file | |
done | |
echo All done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment