From 6a13d7935b048171ab4ff8bd63bdad6f86353783 Mon Sep 17 00:00:00 2001 From: ProGamerGov Date: Sat, 12 Oct 2019 15:01:12 -0600 Subject: [PATCH] Add files via upload --- multires_content2style.sh | 27 ++++++----- multires_style2content.sh | 27 ++++++----- multires_style2content_hist.sh | 27 ++++++----- multires_style2content_hist_large_cp.sh | 60 ++++++++++++++----------- 4 files changed, 86 insertions(+), 55 deletions(-) diff --git a/multires_content2style.sh b/multires_content2style.sh index 3329619..5e6fc0f 100644 --- a/multires_content2style.sh +++ b/multires_content2style.sh @@ -1,14 +1,21 @@ CONTENT_IMAGE=content_image.jpg STYLE_IMAGE=style_image.png -INTERPRETER=python -NEURAL_STYLE=neural_style.py +INTERPRETER=python3 # Replace with 'th' for neural_style.lua or 'python' for python 2 +SCRIPT=neural_style.py # Replace with 'neural_style.lua' for the original neural-style + +NEURAL_STYLE=$INTERPRETER +NEURAL_STYLE+=" " +NEURAL_STYLE+=$SCRIPT + +# Uncomment if using pip package +#NEURAL_STYLE=neural-style # Histogram Matching from content image to style image python linear-color-transfer.py --target_image $STYLE_IMAGE --source_image $CONTENT_IMAGE --output_image style_colored_pca.png -$INTERPRETER $NEURAL_STYLE \ +$NEURAL_STYLE \ -content_image $CONTENT_IMAGE \ -style_image style_colored_pca.png \ -init image \ @@ -17,7 +24,7 @@ $INTERPRETER $NEURAL_STYLE \ -image_size 640 \ -num_iterations 1500 -$INTERPRETER $NEURAL_STYLE \ +$NEURAL_STYLE \ -content_image $CONTENT_IMAGE \ -style_image style_colored_pca.png \ -init image -init_image out1.png \ @@ -26,7 +33,7 @@ $INTERPRETER $NEURAL_STYLE \ -image_size 768 \ -num_iterations 1000 -$INTERPRETER $NEURAL_STYLE \ +$NEURAL_STYLE \ -content_image $CONTENT_IMAGE \ -style_image style_colored_pca.png \ -init image -init_image out2.png \ @@ -35,7 +42,7 @@ $INTERPRETER $NEURAL_STYLE \ -num_iterations 500 \ -output_image out3.png \ -$INTERPRETER $NEURAL_STYLE \ +$NEURAL_STYLE \ -content_image $CONTENT_IMAGE \ -style_image style_colored_pca.png \ -init image -init_image out3.png \ @@ -44,7 +51,7 @@ $INTERPRETER $NEURAL_STYLE \ -num_iterations 200 \ -output_image out4.png \ -$INTERPRETER $NEURAL_STYLE \ +$NEURAL_STYLE \ -content_image $CONTENT_IMAGE \ -style_image style_colored_pca.png \ -init image -init_image out4.png \ @@ -53,7 +60,7 @@ $INTERPRETER $NEURAL_STYLE \ -num_iterations 200 \ -output_image out5.png \ -$INTERPRETER $NEURAL_STYLE \ +$NEURAL_STYLE \ -content_image $CONTENT_IMAGE \ -style_image style_colored_pca.png \ -init image -init_image out5.png \ @@ -62,7 +69,7 @@ $INTERPRETER $NEURAL_STYLE \ -num_iterations 200 \ -output_image out6.png \ -$INTERPRETER $NEURAL_STYLE \ +$NEURAL_STYLE \ -content_image $CONTENT_IMAGE \ -style_image style_colored_pca.png \ -init image -init_image out6.png \ @@ -71,7 +78,7 @@ $INTERPRETER $NEURAL_STYLE \ -num_iterations 200 \ -output_image out7.png -$INTERPRETER $NEURAL_STYLE \ +$NEURAL_STYLE \ -content_image $CONTENT_IMAGE \ -style_image style_colored_pca.png \ -init image -init_image out7.png \ diff --git a/multires_style2content.sh b/multires_style2content.sh index 8728e60..5e0c325 100644 --- a/multires_style2content.sh +++ b/multires_style2content.sh @@ -1,14 +1,21 @@ CONTENT_IMAGE=content_image.jpg STYLE_IMAGE=style_image.png -INTERPRETER=python -NEURAL_STYLE=neural_style.py +INTERPRETER=python3 # Replace with 'th' for neural_style.lua or 'python' for python 2 +SCRIPT=neural_style.py # Replace with 'neural_style.lua' for the original neural-style + +NEURAL_STYLE=$INTERPRETER +NEURAL_STYLE+=" " +NEURAL_STYLE+=$SCRIPT + +# Uncomment if using pip package +#NEURAL_STYLE=neural-style # Histogram Matching from style image to content image python linear-color-transfer.py --target_image $CONTENT_IMAGE --source_image $STYLE_IMAGE --output_image content_colored_pca.png -$INTERPRETER $NEURAL_STYLE \ +$NEURAL_STYLE \ -content_image content_colored_pca.png \ -style_image $STYLE_IMAGE \ -init image \ @@ -17,7 +24,7 @@ $INTERPRETER $NEURAL_STYLE \ -image_size 640 \ -num_iterations 1500 -$INTERPRETER $NEURAL_STYLE \ +$NEURAL_STYLE \ -content_image content_colored_pca.png \ -style_image $STYLE_IMAGE \ -init image -init_image out1.png \ @@ -26,7 +33,7 @@ $INTERPRETER $NEURAL_STYLE \ -image_size 768 \ -num_iterations 1000 -$INTERPRETER $NEURAL_STYLE \ +$NEURAL_STYLE \ -content_image content_colored_pca.png \ -style_image $STYLE_IMAGE \ -init image -init_image out2.png \ @@ -35,7 +42,7 @@ $INTERPRETER $NEURAL_STYLE \ -num_iterations 500 \ -output_image out3.png \ -$INTERPRETER $NEURAL_STYLE \ +$NEURAL_STYLE \ -content_image content_colored_pca.png \ -style_image $STYLE_IMAGE \ -init image -init_image out3.png \ @@ -44,7 +51,7 @@ $INTERPRETER $NEURAL_STYLE \ -num_iterations 200 \ -output_image out4.png \ -$INTERPRETER $NEURAL_STYLE \ +$NEURAL_STYLE \ -content_image content_colored_pca.png \ -style_image $STYLE_IMAGE \ -init image -init_image out4.png \ @@ -53,7 +60,7 @@ $INTERPRETER $NEURAL_STYLE \ -num_iterations 200 \ -output_image out5.png \ -$INTERPRETER $NEURAL_STYLE \ +$NEURAL_STYLE \ -content_image content_colored_pca.png \ -style_image $STYLE_IMAGE \ -init image -init_image out5.png \ @@ -62,7 +69,7 @@ $INTERPRETER $NEURAL_STYLE \ -num_iterations 200 \ -output_image out6.png \ -$INTERPRETER $NEURAL_STYLE \ +$NEURAL_STYLE \ -content_image content_colored_pca.png \ -style_image $STYLE_IMAGE \ -init image -init_image out6.png \ @@ -71,7 +78,7 @@ $INTERPRETER $NEURAL_STYLE \ -num_iterations 200 \ -output_image out7.png -$INTERPRETER $NEURAL_STYLE \ +$NEURAL_STYLE \ -content_image content_colored_pca.png \ -style_image $STYLE_IMAGE \ -init image -init_image out7.png \ diff --git a/multires_style2content_hist.sh b/multires_style2content_hist.sh index 7ae0394..d6c4f15 100644 --- a/multires_style2content_hist.sh +++ b/multires_style2content_hist.sh @@ -1,14 +1,21 @@ CONTENT_IMAGE=content_image.jpg STYLE_IMAGE=style_image.png -INTERPRETER=python -NEURAL_STYLE=neural_style.py +INTERPRETER=python3 +SCRIPT=neural_style.py + +NEURAL_STYLE=$INTERPRETER +NEURAL_STYLE+=" " +NEURAL_STYLE+=$SCRIPT + +# Uncomment if using pip package +#NEURAL_STYLE=neural-style # Histogram Matching from style image to content image python linear-color-transfer.py --target_image $CONTENT_IMAGE --source_image $STYLE_IMAGE --output_image content_colored_pca.png -$INTERPRETER $NEURAL_STYLE \ +$NEURAL_STYLE \ -content_image content_colored_pca.png \ -style_image $STYLE_IMAGE \ -init image \ @@ -19,7 +26,7 @@ $INTERPRETER $NEURAL_STYLE \ python linear-color-transfer.py --target_image out1.png --source_image $STYLE_IMAGE --output_image out1_hist_colored_pca.png -$INTERPRETER $NEURAL_STYLE \ +$NEURAL_STYLE \ -content_image content_colored_pca.png \ -style_image $STYLE_IMAGE \ -init image -init_image out1_hist_colored_pca.png \ @@ -30,7 +37,7 @@ $INTERPRETER $NEURAL_STYLE \ python linear-color-transfer.py --target_image out2.png --source_image $STYLE_IMAGE --output_image out2_hist_colored_pca.png -$INTERPRETER $NEURAL_STYLE \ +$NEURAL_STYLE \ -content_image content_colored_pca.png \ -style_image $STYLE_IMAGE \ -init image -init_image out2_hist_colored_pca.png \ @@ -41,7 +48,7 @@ $INTERPRETER $NEURAL_STYLE \ python linear-color-transfer.py --target_image out3.png --source_image $STYLE_IMAGE --output_image out3_hist_colored_pca.png -$INTERPRETER $NEURAL_STYLE \ +$NEURAL_STYLE \ -content_image content_colored_pca.png \ -style_image $STYLE_IMAGE \ -init image -init_image out3_hist_colored_pca.png \ @@ -52,7 +59,7 @@ $INTERPRETER $NEURAL_STYLE \ python linear-color-transfer.py --target_image out4.png --source_image $STYLE_IMAGE --output_image out4_hist_colored_pca.png -$INTERPRETER $NEURAL_STYLE \ +$NEURAL_STYLE \ -content_image content_colored_pca.png \ -style_image $STYLE_IMAGE \ -init image -init_image out4_hist_colored_pca.png \ @@ -63,7 +70,7 @@ $INTERPRETER $NEURAL_STYLE \ python linear-color-transfer.py --target_image out5.png --source_image $STYLE_IMAGE --output_image out5_hist_colored_pca.png -$INTERPRETER $NEURAL_STYLE \ +$NEURAL_STYLE \ -content_image content_colored_pca.png \ -style_image $STYLE_IMAGE \ -init image -init_image out5_hist_colored_pca.png \ @@ -74,7 +81,7 @@ $INTERPRETER $NEURAL_STYLE \ python linear-color-transfer.py --target_image out6.png --source_image $STYLE_IMAGE --output_image out6_hist_colored_pca.png -$INTERPRETER $NEURAL_STYLE \ +$NEURAL_STYLE \ -content_image content_colored_pca.png \ -style_image $STYLE_IMAGE \ -init image -init_image out6_hist_colored_pca.png \ @@ -85,7 +92,7 @@ $INTERPRETER $NEURAL_STYLE \ python linear-color-transfer.py --target_image out7.png --source_image $STYLE_IMAGE --output_image out7_hist_colored_pca.png -$INTERPRETER $NEURAL_STYLE \ +$NEURAL_STYLE \ -content_image content_colored_pca.png \ -style_image $STYLE_IMAGE \ -init image -init_image out7_hist_colored_pca.png \ diff --git a/multires_style2content_hist_large_cp.sh b/multires_style2content_hist_large_cp.sh index 6d1bf53..c05330e 100644 --- a/multires_style2content_hist_large_cp.sh +++ b/multires_style2content_hist_large_cp.sh @@ -2,17 +2,27 @@ # wget https://github.com/yihui-he/channel-pruning/releases/download/channel_pruning_5x/channel_pruning.caffemodel # wget https://github.com/yihui-he/channel-pruning/releases/download/channel_pruning_5x/channel_pruning.prototxt -CONTENT_IMAGE=content_image.jpg -STYLE_IMAGE=style_image.png +# Or you can get the PyTorch model from: https://github.com/ProGamerGov/neural-style-pt/wiki/Other-Models -INTERPRETER=python -NEURAL_STYLE=neural_style.py +INTERPRETER=python3 # Replace with 'th' for neural_style.lua or 'python' for python 2 +SCRIPT=neural_style.py # Replace with 'neural_style.lua' for the original neural-style + +NEURAL_STYLE=$INTERPRETER +NEURAL_STYLE+=" " +NEURAL_STYLE+=$SCRIPT + +# Uncomment if using pip package +#NEURAL_STYLE=neural-style + + +PRUNED_MODEL="-model_file models/channel_pruning" +# PRUNED_MODEL="$PRUNED_MODEL" # Uncomment for neural_style.lua # Histogram Matching from style image to content image python linear-color-transfer.py --target_image $CONTENT_IMAGE --source_image $STYLE_IMAGE --output_image content_colored_pca.png -$INTERPRETER $NEURAL_STYLE \ +$NEURAL_STYLE \ -content_image content_colored_pca.png \ -style_image $STYLE_IMAGE \ -init image \ @@ -23,7 +33,7 @@ $INTERPRETER $NEURAL_STYLE \ python linear-color-transfer.py --target_image out1.png --source_image $STYLE_IMAGE --output_image out1_hist_colored_pca.png -$INTERPRETER $NEURAL_STYLE \ +$NEURAL_STYLE \ -content_image content_colored_pca.png \ -style_image $STYLE_IMAGE \ -init image -init_image out1_hist_colored_pca.png \ @@ -34,7 +44,7 @@ $INTERPRETER $NEURAL_STYLE \ python linear-color-transfer.py --target_image out2.png --source_image $STYLE_IMAGE --output_image out2_hist_colored_pca.png -$INTERPRETER $NEURAL_STYLE \ +$NEURAL_STYLE \ -content_image content_colored_pca.png \ -style_image $STYLE_IMAGE \ -init image -init_image out2_hist_colored_pca.png \ @@ -45,7 +55,7 @@ $INTERPRETER $NEURAL_STYLE \ python linear-color-transfer.py --target_image out3.png --source_image $STYLE_IMAGE --output_image out3_hist_colored_pca.png -$INTERPRETER $NEURAL_STYLE \ +$NEURAL_STYLE \ -content_image content_colored_pca.png \ -style_image $STYLE_IMAGE \ -init image -init_image out3_hist_colored_pca.png \ @@ -56,7 +66,7 @@ $INTERPRETER $NEURAL_STYLE \ python linear-color-transfer.py --target_image out4.png --source_image $STYLE_IMAGE --output_image out4_hist_colored_pca.png -$INTERPRETER $NEURAL_STYLE \ +$NEURAL_STYLE \ -content_image content_colored_pca.png \ -style_image $STYLE_IMAGE \ -init image -init_image out4_hist_colored_pca.png \ @@ -67,7 +77,7 @@ $INTERPRETER $NEURAL_STYLE \ python linear-color-transfer.py --target_image out5.png --source_image $STYLE_IMAGE --output_image out5_hist_colored_pca.png -$INTERPRETER $NEURAL_STYLE \ +$NEURAL_STYLE \ -content_image content_colored_pca.png \ -style_image $STYLE_IMAGE \ -init image -init_image out5_hist_colored_pca.png \ @@ -80,7 +90,7 @@ python linear-color-transfer.py --target_image out6.png --source_image $STYLE_IM # Use the channel pruning model in this step if the image dimensions are too large -$INTERPRETER $NEURAL_STYLE \ +$NEURAL_STYLE \ -content_image content_colored_pca.png \ -style_image $STYLE_IMAGE \ -init image -init_image out6_hist_colored_pca.png \ @@ -91,77 +101,77 @@ $INTERPRETER $NEURAL_STYLE \ python linear-color-transfer.py --target_image out7.png --source_image $STYLE_IMAGE --output_image out7_hist_colored_pca.png -$INTERPRETER $NEURAL_STYLE \ +$NEURAL_STYLE \ -content_image content_colored_pca.png \ -style_image $STYLE_IMAGE \ -init image -init_image out7_hist_colored_pca.png \ - -tv_weight 0 -seed 876 -save_iter 0 -print_iter 50 -init image -proto_file models/channel_pruning.prototxt -model_file models/channel_pruning.caffemodel -backend cudnn -cudnn_autotune -optimizer adam \ + -tv_weight 0 -seed 876 -save_iter 0 -print_iter 50 -init image $PRUNED_MODEL -backend cudnn -cudnn_autotune -optimizer adam \ -image_size 2048 \ -num_iterations 200 \ -output_image out8.png python linear-color-transfer.py --target_image out8.png --source_image $STYLE_IMAGE --output_image out8_hist_colored_pca.png -$INTERPRETER $NEURAL_STYLE \ +$NEURAL_STYLE \ -content_image content_colored_pca.png \ -style_image $STYLE_IMAGE \ -init image -init_image out8_hist_colored_pca.png \ - -tv_weight 0 -seed 876 -save_iter 0 -print_iter 50 -init image -proto_file models/channel_pruning.prototxt -model_file models/channel_pruning.caffemodel -backend cudnn -cudnn_autotune -optimizer adam \ + -tv_weight 0 -seed 876 -save_iter 0 -print_iter 50 -init image $PRUNED_MODEL -backend cudnn -cudnn_autotune -optimizer adam \ -image_size 2432 \ -num_iterations 200 \ -output_image out9.png python linear-color-transfer.py --target_image out9.png --source_image $STYLE_IMAGE --output_image out9_hist_colored_pca.png -$INTERPRETER $NEURAL_STYLE \ +$NEURAL_STYLE \ -content_image content_colored_pca.png \ -style_image $STYLE_IMAGE \ -init image -init_image out9_hist_colored_pca.png \ - -tv_weight 0 -seed 876 -save_iter 0 -print_iter 50 -init image -proto_file models/channel_pruning.prototxt -model_file models/channel_pruning.caffemodel -backend cudnn -cudnn_autotune -optimizer adam \ + -tv_weight 0 -seed 876 -save_iter 0 -print_iter 50 -init image $PRUNED_MODEL -backend cudnn -cudnn_autotune -optimizer adam \ -image_size 2560 \ -num_iterations 200 \ -output_image out10.png python linear-color-transfer.py --target_image out10.png --source_image $STYLE_IMAGE --output_image out10_hist_colored_pca.png -$INTERPRETER $NEURAL_STYLE \ +$NEURAL_STYLE \ -content_image content_colored_pca.png \ -style_image $STYLE_IMAGE \ -init image -init_image out10_hist_colored_pca.png \ - -tv_weight 0 -seed 876 -save_iter 0 -print_iter 50 -init image -proto_file models/channel_pruning.prototxt -model_file models/channel_pruning.caffemodel -backend cudnn -cudnn_autotune -optimizer adam \ + -tv_weight 0 -seed 876 -save_iter 0 -print_iter 50 -init image $PRUNED_MODEL -backend cudnn -cudnn_autotune -optimizer adam \ -image_size 2816 \ -num_iterations 200 \ -output_image out11.png python linear-color-transfer.py --target_image out11.png --source_image $STYLE_IMAGE --output_image out11_hist_colored_pca.png -$INTERPRETER $NEURAL_STYLE \ +$NEURAL_STYLE \ -content_image content_colored_pca.png \ -style_image $STYLE_IMAGE \ -init image -init_image out11_hist_colored_pca.png \ - -tv_weight 0 -seed 876 -save_iter 0 -print_iter 50 -init image -proto_file models/channel_pruning.prototxt -model_file models/channel_pruning.caffemodel -backend cudnn -cudnn_autotune -optimizer adam \ + -tv_weight 0 -seed 876 -save_iter 0 -print_iter 50 -init image $PRUNED_MODEL -backend cudnn -cudnn_autotune -optimizer adam \ -image_size 2944 \ -num_iterations 200 \ -output_image out12.png python linear-color-transfer.py --target_image out12.png --source_image $STYLE_IMAGE --output_image out12_hist_colored_pca.png -$INTERPRETER $NEURAL_STYLE \ +$NEURAL_STYLE \ -content_image content_colored_pca.png \ -style_image $STYLE_IMAGE \ -init image -init_image out12_hist_colored_pca.png \ - -tv_weight 0 -seed 876 -save_iter 0 -print_iter 50 -init image -proto_file models/channel_pruning.prototxt -model_file models/channel_pruning.caffemodel -backend cudnn -cudnn_autotune -optimizer adam \ + -tv_weight 0 -seed 876 -save_iter 0 -print_iter 50 -init image $PRUNED_MODEL -backend cudnn -cudnn_autotune -optimizer adam \ -image_size 3328 \ -num_iterations 200 \ -output_image out13.png python linear-color-transfer.py --target_image out13.png --source_image $STYLE_IMAGE --output_image out13_hist_colored_pca.png -$INTERPRETER $NEURAL_STYLE \ +$NEURAL_STYLE \ -content_image content_colored_pca.png \ -style_image $STYLE_IMAGE \ -init image -init_image out13_hist_colored_pca.png \ - -tv_weight 0 -seed 876 -save_iter 0 -print_iter 50 -init image -proto_file models/channel_pruning.prototxt -model_file models/channel_pruning.caffemodel -backend cudnn -cudnn_autotune -optimizer adam \ + -tv_weight 0 -seed 876 -save_iter 0 -print_iter 50 -init image $PRUNED_MODEL -backend cudnn -cudnn_autotune -optimizer adam \ -image_size 3400 \ -num_iterations 200 \ -output_image out14.png