diff --git a/img/normanlewisuntitled.jpg b/img/normanlewisuntitled.jpg new file mode 100644 index 0000000..7657eb7 Binary files /dev/null and b/img/normanlewisuntitled.jpg differ diff --git a/python/install_neural.sh b/python/install_neural.sh new file mode 100644 index 0000000..98411b7 --- /dev/null +++ b/python/install_neural.sh @@ -0,0 +1,6 @@ +#!/bin/bash -e + +#https://github.com/ProGamerGov/neural-style-pt + +python3 -m pip install neural-style +neural-style -download_models ./ diff --git a/python/neural.sh b/python/neural.sh new file mode 100644 index 0000000..bbe0a5d --- /dev/null +++ b/python/neural.sh @@ -0,0 +1,24 @@ +#!/bin/bash + +INPUT="${1}" +STYLE="${2}" +OUTPUT="${3}" + +mkdir -p frames +mkdir -p neural-frames + +ffmpeg -i "${INPUT}" frames/frame-%06d.png + +FRAMES=frames/*.png + +for frame in ${FRAMES}; do + echo "Running style transfer $frame -> neural-$frame ..." + bash python/style_transfer.sh "${frame}" "${STYLE}" "neural-${frame}" +done + +sleep 10 + +ffmpeg -f image2 -i frames/neural-frame-%06d.png -c:v prores_ks -profile:v 3 "${OUTPUT}" + +#rm -rf frames +#rm -rf neural-frames \ No newline at end of file diff --git a/python/style_transfer.sh b/python/style_transfer.sh new file mode 100644 index 0000000..3d228cf --- /dev/null +++ b/python/style_transfer.sh @@ -0,0 +1,24 @@ +#!/bin/bash + +INPUT="${1}" +STYLE="${2}" +OUTPUT="${3}" + +# https://github.com/ProGamerGov/neural-style-pt + +neural-style \ + -style_image "${STYLE}" \ + -content_image "${INPUT}" \ + -output_image "${OUTPUT}" \ + -model_file python/nin_imagenet.pth \ + -gpu c \ + -backend nn \ + -num_iterations 500 \ + -seed 123 \ + -content_layers relu0,relu3,relu7,relu12 \ + -style_layers relu0,relu3,relu7,relu12 \ + -content_weight 10 \ + -style_weight 500 \ + -save_iter 0 \ + -image_size 720 \ + -optimizer adam