Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion neural_style_transfer.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
5 changes: 5 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
matplotlib
torch
torchvision
numpy
opencv-python
35 changes: 35 additions & 0 deletions scripts/style_transfer_all.py
Original file line number Diff line number Diff line change
@@ -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))