-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbatch_style
executable file
·71 lines (63 loc) · 1.98 KB
/
batch_style
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#!/usr/bin/env python
# import argparse
import errno
import io
import os
import re
import subprocess
import sys
import json
import math
import copy
import neural_style as ns
def main():
manifest = sys.argv[1]
if sys.argv[1]:
with open(sys.argv[1], "r") as manifest_file:
manifest = json.load(manifest_file)
args = [
"--original_colors",
"--model_weights",
"datasets/imagenet-vgg-verydeep-19.mat",
"--content_img",
manifest["filename"],
"--style_imgs",
manifest["style_image"],
"--max_iterations",
str(manifest["max_iterations"]),
"--device",
"/gpu:0",
"--content_weight",
"10",
"--style_weight",
str(manifest["style_weight"]),
"--max_size",
"1400",
"--img_name",
os.path.splitext(manifest["filename_styled"])[0],
]
ns.main(args)
# for face in manifest["faces"]:
# args = [
# "--original_colors",
# "--model_weights",
# "datasets/imagenet-vgg-verydeep-19.mat",
# "--content_img",
# face["filename"],
# "--style_imgs",
# face["style_image"],
# "--max_iterations",
# str(face["max_iterations"]),
# "--device",
# "/gpu:0",
# "--content_weight",
# "10",
# "--style_weight",
# str(face["style_weight"]),
# "--max_size",
# "1000",
# "--img_name",
# os.path.splitext(face["filename_styled"])[0],
# ]
# ns.main(args)
main()