Skip to content

Commit 5aedfa6

Browse files
committed
Update server train script.
1 parent aa697ac commit 5aedfa6

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

demos/video/style-transfer/neural_style_dev_server_working_2.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,15 @@ def check_paths(args):
5353
print(e)
5454
sys.exit(1)
5555

56+
import math
57+
def to_sci_not(x):
58+
exp = math.floor(math.log10(abs(x)))
59+
multiplier = 10 ** exp
60+
return (x / multiplier), exp
61+
5662
def get_file_name(args):
57-
style_name = os.path.splitext(os.path.basename(args.style_image))[0]
58-
return f'{args.style_image}_ep{args.epochs}_bt{args.batch_size}_sw{args.style_weight}_cw_{args.content_weight}'
63+
base_name,_ = os.path.splitext(os.path.basename(args.style_image))
64+
return f'{base_name}_ep{args.epochs}_bt{args.batch_size}_sw{to_sci_not(args.style_weight)}_cw_{to_sci_not(args.content_weight)}'
5965

6066
def train(args):
6167
if args.accel:

0 commit comments

Comments
 (0)