diff --git a/neural_style_transfer.py b/neural_style_transfer.py index bfc70e6..d4c05b9 100644 --- a/neural_style_transfer.py +++ b/neural_style_transfer.py @@ -142,7 +142,7 @@ def closure(): parser = argparse.ArgumentParser() parser.add_argument("--content_img_name", type=str, help="content image name", default='figures.jpg') parser.add_argument("--style_img_name", type=str, help="style image name", default='vg_starry_night.jpg') - parser.add_argument("--height", type=int, help="height of content and style images", default=400) + parser.add_argument("--height", type=int, help="height of content and style images", default=720) parser.add_argument("--content_weight", type=float, help="weight factor for content loss", default=1e5) parser.add_argument("--style_weight", type=float, help="weight factor for style loss", default=3e4) diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..4e54d2c --- /dev/null +++ b/requirements.txt @@ -0,0 +1,5 @@ +matplotlib +torch +torchvision +numpy +opencv-python diff --git a/scripts/style_transfer_all.py b/scripts/style_transfer_all.py new file mode 100755 index 0000000..0f789d5 --- /dev/null +++ b/scripts/style_transfer_all.py @@ -0,0 +1,35 @@ +#!/usr/bin/env python3 + +# Does neural style transfer for each content image and style image pair +# Run from root of project + +import subprocess +from pathlib import Path + +DEBUG=False + +def run_command(args): + if DEBUG: + print(args) + else: + subprocess.run(args) + +run_command(['touch', 'test']) + +data_dir = Path('data') +content_dir = data_dir / 'content-images' +style_dir = data_dir / 'style-images' + +content_images = [f.name for f in list(content_dir.iterdir())] +style_images = [f.name for f in list(style_dir.iterdir())] + +i = 0 +for content_image in content_images: + for style_image in style_images: + run_command(['python3', 'neural_style_transfer.py', + '--content_img_name', content_image, + '--style_img_name', style_image, + '--height', '720']) + i += 1 + print('Finished image ' + str(i)) +