From d48a55f41188ac3cba7202c3ccfe74e5d8203b69 Mon Sep 17 00:00:00 2001 From: xAlpharax <42233094+xAlpharax@users.noreply.github.com> Date: Sat, 4 Mar 2023 03:29:19 +0200 Subject: Minor changes for the user's script. --- clear_dir.sh | 2 +- colorful_in_Azzalee.mp4 | Bin 0 -> 1791291 bytes kek_in_Starry_Night.mp4 | Bin 0 -> 4754080 bytes neuralart.py | 2 +- renderer.py | 1 + requirements.txt | 6 ++++++ stylize.sh | 8 ++++---- 7 files changed, 13 insertions(+), 6 deletions(-) create mode 100644 colorful_in_Azzalee.mp4 create mode 100644 kek_in_Starry_Night.mp4 diff --git a/clear_dir.sh b/clear_dir.sh index fef1764..fd3880f 100755 --- a/clear_dir.sh +++ b/clear_dir.sh @@ -3,5 +3,5 @@ ### clearing up the directory ### from temporary files -rm -rf __pycache__ # Output* future proof +rm -rf __pycache__ # Output* future rm -f Output/*.png *.npy diff --git a/colorful_in_Azzalee.mp4 b/colorful_in_Azzalee.mp4 new file mode 100644 index 0000000..a99b2e1 Binary files /dev/null and b/colorful_in_Azzalee.mp4 differ diff --git a/kek_in_Starry_Night.mp4 b/kek_in_Starry_Night.mp4 new file mode 100644 index 0000000..738b418 Binary files /dev/null and b/kek_in_Starry_Night.mp4 differ diff --git a/neuralart.py b/neuralart.py index ebbbb94..2495da8 100644 --- a/neuralart.py +++ b/neuralart.py @@ -243,7 +243,7 @@ n_iter = [0] image_array = [] -with tqdm(total=max_iter) as pbar: +with tqdm(total=max_iter, miniters=0, smoothing=0) as pbar: while n_iter[0] <= max_iter - 9: # weird behavior here def closure(): diff --git a/renderer.py b/renderer.py index 992b4ab..5975d21 100644 --- a/renderer.py +++ b/renderer.py @@ -17,6 +17,7 @@ if len(sys.argv) == 1: ### image rendering from raw data +import matplotlib as mlp ; mlp.use('agg') ; import matplotlib.pyplot as plt dpi = 258 # dpi 258 -> 720p ; dpi 387 -> 1080p output image resolution diff --git a/requirements.txt b/requirements.txt index e69de29..9bde50e 100644 --- a/requirements.txt +++ b/requirements.txt @@ -0,0 +1,6 @@ +torch +torchvision>=0.2.0 +matplotlib>=3.7.0 +pillow +numpy +tqdm diff --git a/stylize.sh b/stylize.sh index ac9beba..45f1961 100755 --- a/stylize.sh +++ b/stylize.sh @@ -1,6 +1,6 @@ #!/bin/bash -### You must be in the 'neural-art' directory when you run this +set -e ### exit the script if any part of it fails cwd=$(pwd | sed -r 's%.*/%%g') if [ $cwd != "neural-art" ] ; then @@ -20,7 +20,7 @@ if [ $# -eq 1 ] ; then exit 1 fi -./clear_dir.sh +./clear_dir.sh # of now useless files # stylize data [pair (style, content)] python neuralart.py $1 $2 @@ -28,8 +28,8 @@ python neuralart.py $1 $2 # render images (actual frames) from (an) images.npy python renderer.py -# render fix +# fix render artifacts python renderer.py --fix -# turn everything into a video +# wrap everything into a video ffmpeg -framerate 60 -pattern_type glob -i 'Output/neural_art_*.png' -vf "pad=ceil(iw/2)*2:ceil(ih/2)*2" $(basename ${2%.*})'_in_'$(basename ${1%.*})'.mp4' -- cgit v1.2.3