-
Notifications
You must be signed in to change notification settings - Fork 41
/
cmd_test_pipe_dnd.py
97 lines (86 loc) · 6.45 KB
/
cmd_test_pipe_dnd.py
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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
"""
The testing file for rethinking the pipeline
Instruction:
# in_type: current test in_type
# out_type: current test out_type
# model: current model
# pre_in_type: previous test in_type
# pre_out_type: previous test out_type
# pre_model: previous model
# intermidiate intermidiate state default false (false to read from dnd , true to read from previous)
Created by Yuanhao Wang
"""
import os
import argparse
cmd = "git --version"
return_value = os.system(cmd)
print('returned value :', return_value)
parser = argparse.ArgumentParser(description='PyTorch implementation of ISP-Net')
parser.add_argument('--pipeline', type=int, required=True,
help='which pipeline to evaluate'
'DN-> DM->SR: 0'
'DN-> SR->DM: 1'
'DM -> DN -> SR: 2'
'DM -> SR -> DN: 3'
'SR -> DM -> DN: 4'
'SR -> DN -> DM: 5'
'')
parser.add_argument('--pretrain', type=str, required=True)
parser.add_argument('--save_dir', type=str, default=None)
parser.add_argument('--test_data', type=str, required=True)
parser.add_argument('--scale', type=int, default=2)
args = parser.parse_args()
pipeline = args.pipeline
if args.save_dir is None:
args.save_dir = os.path.join(args.pretrain, 'pipe_result')
if pipeline == 0:
# cmd1 denoise
# cmd2 demosaic
# cmd3 super resolution
# DN-> DM->SR
cmd1 = "python test_pipe_dnd.py --phase test --in_type noisy_raw --out_type raw --pre_out_type raw --model resnet --pretrain {} --save_dir {}/dndmsr --test_data {}".format(args.pretrain, args.save_dir, args.test_data)
cmd2 = "python test_pipe_dnd.py --phase test --in_type raw --out_type linrgb --pre_in_type noisy_raw --pre_out_type raw --model resnet --pre_model resnet --intermediate 1 --pretrain {} --save_dir {}/dndmsr".format(args.pretrain, args.save_dir)
cmd3 = "python test_pipe_dnd.py --phase test --in_type lr_linrgb --out_type linrgb --pre_in_type raw --pre_out_type linrgb --model resnet --pre_model resnet --intermediate 1 --pretrain {} --save_dir {}/dndmsr --scale {}".format(args.pretrain, args.save_dir, args.scale)
elif pipeline == 1:
# cmd1 denoise
# cmd2 super resolution
# cmd3 demosaic
# DN-> SR->DM
cmd1 = "python test_pipe_dnd.py --phase test --in_type noisy_raw --out_type raw --pre_out_type raw --model resnet --pretrain {} --save_dir {}/dnsrdm --test_data {}".format(args.pretrain, args.save_dir, args.test_data)
cmd2 = "python test_pipe_dnd.py --phase test --in_type lr_raw --out_type raw --pre_in_type noisy_raw --pre_out_type raw --model resnet --pre_model resnet --intermediate 1 --pretrain {} --save_dir {}/dnsrdm --scale {}".format(args.pretrain, args.save_dir, args.scale)
cmd3 = "python test_pipe_dnd.py --phase test --in_type raw --out_type linrgb --pre_in_type lr_raw --pre_out_type raw --model resnet --pre_model resnet --intermediate 1 --pretrain {} --save_dir {}/dnsrdm".format(args.pretrain, args.save_dir)
elif pipeline == 2:
# cmd1 demosaic
# cmd2 denoise
# cmd3 super resolution
# DM -> DN -> SR
cmd1 = "python test_pipe_dnd.py --phase test --in_type raw --out_type linrgb --pre_out_type raw --model resnet --pretrain {} --save_dir {}/dmdnsr --test_data {}".format(args.pretrain, args.save_dir, args.test_data)
cmd2 = "python test_pipe_dnd.py --phase test --in_type noisy_linrgb --out_type linrgb --pre_in_type raw --pre_out_type linrgb --model resnet --pre_model resnet --intermediate 1 --pretrain {} --save_dir {}/dmdnsr".format(args.pretrain, args.save_dir)
cmd3 = "python test_pipe_dnd.py --phase test --in_type lr_linrgb --out_type linrgb --pre_in_type noisy_rgb --pre_out_type rgb --model resnet --pre_model resnet --intermediate 1 --pretrain {} --save_dir {}/dmdnsr --scale {}".format(args.pretrain, args.save_dir, args.scale)
elif pipeline == 3:
# cmd1 demosaic
# cmd2 super resolution
# cmd3 denoise
# DM -> SR -> DN
cmd1 = "python test_pipe_dnd.py --phase test --in_type raw --out_type linrgb --pre_out_type raw --model resnet --pretrain {} --save_dir {}/dmsrdn --test_data {}".format(args.pretrain, args.save_dir, args.test_data)
cmd2 = "python test_pipe_dnd.py --phase test --in_type lr_linrgb --out_type linrgb --pre_in_type raw --pre_out_type linrgb --model resnet --pre_model resnet --intermediate 1 --pretrain {} --save_dir {}/dmsrdn --scale {}".format(args.pretrain, args.save_dir, args.scale)
cmd3 = "python test_pipe_dnd.py --phase test --in_type noisy_linrgb --out_type linrgb --pre_in_type noisy_rgb --pre_out_type linrgb --model resnet --pre_model resnet --intermediate 1 --pretrain {} --save_dir {}/dmsrdn".format(args.pretrain, args.save_dir)
elif pipeline == 4:
# cmd1 super resolution
# cmd2 demosaic
# cmd3 denoise
# SR -> DM -> DN
cmd1 = "python test_pipe_dnd.py --phase test --in_type lr_raw --out_type raw --pre_out_type raw --model resnet --pretrain {} --save_dir {}/srdmdn --test_data {} --scale {}".format(args.pretrain, args.save_dir, args.test_data, args.scale)
cmd2 = "python test_pipe_dnd.py --phase test --in_type raw --out_type linrgb --pre_in_type lr_raw --pre_out_type raw --model resnet --pre_model resnet --intermediate 1 --pretrain {} --save_dir {}/srdmdn".format(args.pretrain, args.save_dir)
cmd3 = "python test_pipe_dnd.py --phase test --in_type noisy_linrgb --out_type linrgb --pre_in_type raw --pre_out_type linrgb --model resnet --pre_model resnet --intermediate 1 --pretrain {} --save_dir {}/srdmdn".format(args.pretrain, args.save_dir)
elif pipeline == 5:
# cmd1 super resolution
# cmd2 denoise
# cmd3 demosaic
# SR -> DN -> DM
cmd1 = "python test_pipe_dnd.py --phase test --in_type lr_raw --out_type raw --pre_out_type raw --model resnet --pretrain {} --save_dir {}/srdndm --test_data {} --scale {}".format(args.pretrain, args.save_dir, args.test_data, args.scale)
cmd2 = "python test_pipe_dnd.py --phase test --in_type noisy_raw --out_type raw --pre_in_type lr_raw --pre_out_type raw --model resnet --pre_model resnet --intermediate 1 --pretrain {} --save_dir {}/srdndm".format(args.pretrain, args.save_dir)
cmd3 = "python test_pipe_dnd.py --phase test --in_type raw --out_type linrgb --pre_in_type noisy_raw --pre_out_type raw --model resnet --pre_model resnet --intermediate 1 --pretrain {} --save_dir {}/srdndm".format(args.pretrain, args.save_dir)
return_value = os.system(cmd1)
# return_value = os.system(cmd2)
# return_value = os.system(cmd3)