Add neural style transfer example
This commit is contained in:
parent
6537ada194
commit
cb0684a574
Binary file not shown.
After Width: | Height: | Size: 94 KiB |
|
@ -0,0 +1,6 @@
|
|||
#!/bin/bash -e
|
||||
|
||||
#https://github.com/ProGamerGov/neural-style-pt
|
||||
|
||||
python3 -m pip install neural-style
|
||||
neural-style -download_models ./
|
|
@ -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
|
|
@ -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
|
Loading…
Reference in New Issue