summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorxAlpharax <42233094+xAlpharax@users.noreply.github.com>2023-03-04 03:29:19 +0200
committerxAlpharax <42233094+xAlpharax@users.noreply.github.com>2023-03-04 03:29:19 +0200
commitd48a55f41188ac3cba7202c3ccfe74e5d8203b69 (patch)
treee51995fcd85f7b62254d5e29821058e0c484013f
parentbd19b46d7544ff94be0e8eaccb4e1bd18d44b996 (diff)
Minor changes for the user's script.
-rwxr-xr-xclear_dir.sh2
-rw-r--r--colorful_in_Azzalee.mp4bin0 -> 1791291 bytes
-rw-r--r--kek_in_Starry_Night.mp4bin0 -> 4754080 bytes
-rw-r--r--neuralart.py2
-rw-r--r--renderer.py1
-rw-r--r--requirements.txt6
-rwxr-xr-xstylize.sh8
7 files changed, 13 insertions, 6 deletions
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
--- /dev/null
+++ b/colorful_in_Azzalee.mp4
Binary files differ
diff --git a/kek_in_Starry_Night.mp4 b/kek_in_Starry_Night.mp4
new file mode 100644
index 0000000..738b418
--- /dev/null
+++ b/kek_in_Starry_Night.mp4
Binary files 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'