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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
|
from .base_options import BaseOptions
class DatasetOptions(BaseOptions):
def initialize(self, args=None):
# BaseOptions.initialize(self)
# type = int, float, str OR action='store_true'
# self.parser.add_argument(
# '--',
# type=int,
# default=0,
# help=''
# )
required = args is None
self.parser.add_argument(
'--in_dir',
type=str,
required=required,
help='input directory'
)
self.parser.add_argument(
'--out_dir',
type=str,
required=required,
help='output directory'
)
self.parser.add_argument(
'--split',
action='store_true',
help='construct train/test/split for this output, as A'
)
self.parser.add_argument(
'--ab',
action='store_true',
help='construct test split into directory A and B, where B = in_dir'
)
self.parser.add_argument(
'--mov',
action='store_true',
help='generate video from output directory'
)
self.parser.add_argument(
'--render-frames',
action='store_true',
help='render the source frames only'
)
self.parser.add_argument(
'--tag',
type=str,
default="",
help='another way to tag this whole thing'
)
self.parser.add_argument(
'--scp',
action='store_true',
help='scp this file somewhere'
)
self.parser.add_argument(
'--scp-to',
type=str,
default="jules@asdf.us:asdf/neural/",
help='scp destination'
)
## LIVE IMAGE PROCESSING
self.parser.add_argument(
'--send-image',
type=str,
default='b',
help='which image to send... a, b, recursive, sequence'
)
self.parser.add_argument(
'--store-a',
action='store_true',
help='dont remove the generated A image after processing it'
)
self.parser.add_argument(
'--store-b',
action='store_true',
help='after generating a B image, save it to disk'
)
self.parser.add_argument(
'--exit',
action='store_true',
help='exit immediately if set to true (used to interrupt)'
)
## IMAGE FILTERS
### RECURSION
self.parser.add_argument(
'--transition-period',
default=3000,
type=int,
help='period of sine wave transition'
)
self.parser.add_argument(
'--transition-min',
default=1e-3,
type=float,
help='minimum amount of stabilization to apply'
)
self.parser.add_argument(
'--transition-max',
default=1.0,
type=float,
help='maximum amount of stabilization to apply'
)
self.parser.add_argument(
'--recursive',
action='store_true',
help='recurse on previous output'
)
self.parser.add_argument(
'--recursive-frac',
default=0.3,
type=float,
help='amount of previous step to use in recursion'
)
self.parser.add_argument(
'--just-copy',
action='store_true',
help='dont preprocess first frame',
)
self.parser.add_argument(
'--sequence',
action='store_true',
help='recurse guided by image sequence'
)
self.parser.add_argument(
'--sequence-frac',
default=0.2,
type=float,
help='amount of sequence image to use in recursion'
)
self.parser.add_argument(
'--recurse-roll',
default=0,
type=int,
help='in px, roll mixed recursed image 1px to reduce vertical feedback'
)
self.parser.add_argument(
'--recurse-roll-axis',
default=1,
type=int,
help='axis of roll'
)
self.parser.add_argument(
'--process-frac',
default=0.5,
type=float,
help='amount of processed image (clahe, poster, etc) to use in feeder step'
)
### GRAYSCALE
self.parser.add_argument(
'--grayscale',
action='store_true',
help='convert image to grayscale first'
)
### CLAHE
self.parser.add_argument(
'--clahe',
action='store_true',
help='apply clahe contrast correction'
)
self.parser.add_argument(
'--clip-limit',
default=2.0,
type=float,
help='clip limit for clahe algorithm (1.0 is subtle, 4.0 is aggressive)'
)
### POSTERIZE
self.parser.add_argument(
'--posterize',
action='store_true',
help='posterize image'
)
self.parser.add_argument(
'--spatial-window',
default=16,
type=int,
help='spatial window for quantize'
)
self.parser.add_argument(
'--color-window',
default=64,
type=int,
help='color window for quantize'
)
### BRIGHTNESS GRADIENT
self.parser.add_argument(
'--brightness-gradient',
action='store_true',
help='gradiate from first frame to last (done in Lab colorspace)'
)
self.parser.add_argument(
'--brightness-sigma',
default=64,
type=int,
help='width of brightness gradient along L axis'
)
### BLUR
self.parser.add_argument(
'--blur',
action='store_true',
help='blur image by N'
)
self.parser.add_argument(
'--blur-radius',
default=3,
type=int,
help='blur sigma'
)
self.parser.add_argument(
'--blur-sigma',
default=0.0,
type=float,
help='blur sigma'
)
### CANNY EDGE DETECTION
self.parser.add_argument(
'--canny',
action='store_true',
help='do canny edge detection on image'
)
self.parser.add_argument(
'--canny-lo',
default=100,
type=int,
help='canny low threshold'
)
self.parser.add_argument(
'--canny-hi',
default=200,
type=int,
help='canny high threshold'
)
def parse(self, args=None):
if not self.initialized:
self.initialize(args)
if args is not None:
self.opt, unknown = self.parser.parse_known_args(args)
else:
self.opt, unknown = self.parser.parse_known_args()
argz = vars(self.opt)
print('------------ Options -------------')
for k, v in sorted(argz.items()):
print('%s: %s' % (str(k), str(v)))
print('-------------- End ----------------')
return self.opt
|