IliaLarchenko commited on
Commit
75161a8
1 Parent(s): 6684d9c

refactored some names

Browse files
Files changed (2) hide show
  1. configs/augmentations.json +27 -27
  2. src/control.py +5 -5
configs/augmentations.json CHANGED
@@ -10,7 +10,7 @@
10
  100
11
  ],
12
  "param_name": "blur_limit",
13
- "type": "int_interval"
14
  }
15
  ],
16
  "CLAHE": [
@@ -24,7 +24,7 @@
24
  100
25
  ],
26
  "param_name": "clip_limit",
27
- "type": "int_interval"
28
  },
29
  {
30
  "defaults_list": [
@@ -46,7 +46,7 @@
46
  "height",
47
  "width"
48
  ],
49
- "type": "several_ints"
50
  }
51
  ],
52
  "CenterCrop": [
@@ -59,7 +59,7 @@
59
  "image_height"
60
  ]
61
  },
62
- "type": "int_interval"
63
  },
64
  {
65
  "param_name": "width",
@@ -70,7 +70,7 @@
70
  "image_width"
71
  ]
72
  },
73
- "type": "int_interval"
74
  }
75
  ],
76
  "ChannelDropout": [
@@ -84,7 +84,7 @@
84
  3
85
  ],
86
  "param_name": "channel_drop_range",
87
- "type": "int_interval"
88
  },
89
  {
90
  "defaults": 0,
@@ -93,7 +93,7 @@
93
  255
94
  ],
95
  "param_name": "fill_value",
96
- "type": "int_interval"
97
  }
98
  ],
99
  "ChannelShuffle": [],
@@ -143,7 +143,7 @@
143
  100
144
  ],
145
  "param_name": "num_holes",
146
- "type": "int_interval"
147
  },
148
  {
149
  "defaults": 8,
@@ -152,7 +152,7 @@
152
  100
153
  ],
154
  "param_name": "max_h_size",
155
- "type": "int_interval"
156
  },
157
  {
158
  "defaults": 8,
@@ -161,7 +161,7 @@
161
  100
162
  ],
163
  "param_name": "max_w_size",
164
- "type": "int_interval"
165
  },
166
  {
167
  "param_name": "fill_value",
@@ -195,7 +195,7 @@
195
  500.0
196
  ],
197
  "param_name": "var_limit",
198
- "type": "int_interval"
199
  },
200
  {
201
  "defaults": 0.0,
@@ -204,7 +204,7 @@
204
  100.0
205
  ],
206
  "param_name": "mean",
207
- "type": "int_interval"
208
  }
209
  ],
210
  "HorizontalFlip": [],
@@ -219,7 +219,7 @@
219
  100
220
  ],
221
  "param_name": "hue_shift_limit",
222
- "type": "int_interval"
223
  },
224
  {
225
  "defaults": [
@@ -231,7 +231,7 @@
231
  100
232
  ],
233
  "param_name": "sat_shift_limit",
234
- "type": "int_interval"
235
  },
236
  {
237
  "defaults": [
@@ -243,7 +243,7 @@
243
  100
244
  ],
245
  "param_name": "val_shift_limit",
246
- "type": "int_interval"
247
  }
248
  ],
249
  "ImageCompression": [
@@ -300,7 +300,7 @@
300
  100
301
  ],
302
  "param_name": "blur_limit",
303
- "type": "int_interval"
304
  }
305
  ],
306
  "MotionBlur": [
@@ -314,7 +314,7 @@
314
  100
315
  ],
316
  "param_name": "blur_limit",
317
- "type": "int_interval"
318
  }
319
  ],
320
  "RGBShift": [
@@ -328,7 +328,7 @@
328
  255
329
  ],
330
  "param_name": "r_shift_limit",
331
- "type": "int_interval"
332
  },
333
  {
334
  "defaults": [
@@ -340,7 +340,7 @@
340
  255
341
  ],
342
  "param_name": "g_shift_limit",
343
- "type": "int_interval"
344
  },
345
  {
346
  "defaults": [
@@ -352,7 +352,7 @@
352
  255
353
  ],
354
  "param_name": "b_shift_limit",
355
- "type": "int_interval"
356
  }
357
  ],
358
  "RandomBrightness": [
@@ -366,7 +366,7 @@
366
  1.0
367
  ],
368
  "param_name": "limit",
369
- "type": "int_interval"
370
  }
371
  ],
372
  "RandomContrast": [
@@ -380,7 +380,7 @@
380
  1.0
381
  ],
382
  "param_name": "limit",
383
- "type": "int_interval"
384
  }
385
  ],
386
  "RandomFog": [
@@ -406,7 +406,7 @@
406
  1.0
407
  ],
408
  "param_name": "alpha_coef",
409
- "type": "int_interval"
410
  }
411
  ],
412
  "RandomGridShuffle": [
@@ -430,7 +430,7 @@
430
  "height",
431
  "width"
432
  ],
433
- "type": "several_ints"
434
  }
435
  ],
436
  "RandomScale": [
@@ -444,7 +444,7 @@
444
  2.0
445
  ],
446
  "param_name": "scale_limit",
447
- "type": "int_interval"
448
  },
449
  {
450
  "options_list": [
@@ -481,7 +481,7 @@
481
  5.0
482
  ],
483
  "param_name": "brightness_coeff",
484
- "type": "int_interval"
485
  }
486
  ],
487
  "Solarize": [
@@ -492,7 +492,7 @@
492
  255
493
  ],
494
  "param_name": "threshold",
495
- "type": "int_interval"
496
  }
497
  ],
498
  "ToGray": [],
 
10
  100
11
  ],
12
  "param_name": "blur_limit",
13
+ "type": "num_interval"
14
  }
15
  ],
16
  "CLAHE": [
 
24
  100
25
  ],
26
  "param_name": "clip_limit",
27
+ "type": "num_interval"
28
  },
29
  {
30
  "defaults_list": [
 
46
  "height",
47
  "width"
48
  ],
49
+ "type": "several_nums"
50
  }
51
  ],
52
  "CenterCrop": [
 
59
  "image_height"
60
  ]
61
  },
62
+ "type": "num_interval"
63
  },
64
  {
65
  "param_name": "width",
 
70
  "image_width"
71
  ]
72
  },
73
+ "type": "num_interval"
74
  }
75
  ],
76
  "ChannelDropout": [
 
84
  3
85
  ],
86
  "param_name": "channel_drop_range",
87
+ "type": "num_interval"
88
  },
89
  {
90
  "defaults": 0,
 
93
  255
94
  ],
95
  "param_name": "fill_value",
96
+ "type": "num_interval"
97
  }
98
  ],
99
  "ChannelShuffle": [],
 
143
  100
144
  ],
145
  "param_name": "num_holes",
146
+ "type": "num_interval"
147
  },
148
  {
149
  "defaults": 8,
 
152
  100
153
  ],
154
  "param_name": "max_h_size",
155
+ "type": "num_interval"
156
  },
157
  {
158
  "defaults": 8,
 
161
  100
162
  ],
163
  "param_name": "max_w_size",
164
+ "type": "num_interval"
165
  },
166
  {
167
  "param_name": "fill_value",
 
195
  500.0
196
  ],
197
  "param_name": "var_limit",
198
+ "type": "num_interval"
199
  },
200
  {
201
  "defaults": 0.0,
 
204
  100.0
205
  ],
206
  "param_name": "mean",
207
+ "type": "num_interval"
208
  }
209
  ],
210
  "HorizontalFlip": [],
 
219
  100
220
  ],
221
  "param_name": "hue_shift_limit",
222
+ "type": "num_interval"
223
  },
224
  {
225
  "defaults": [
 
231
  100
232
  ],
233
  "param_name": "sat_shift_limit",
234
+ "type": "num_interval"
235
  },
236
  {
237
  "defaults": [
 
243
  100
244
  ],
245
  "param_name": "val_shift_limit",
246
+ "type": "num_interval"
247
  }
248
  ],
249
  "ImageCompression": [
 
300
  100
301
  ],
302
  "param_name": "blur_limit",
303
+ "type": "num_interval"
304
  }
305
  ],
306
  "MotionBlur": [
 
314
  100
315
  ],
316
  "param_name": "blur_limit",
317
+ "type": "num_interval"
318
  }
319
  ],
320
  "RGBShift": [
 
328
  255
329
  ],
330
  "param_name": "r_shift_limit",
331
+ "type": "num_interval"
332
  },
333
  {
334
  "defaults": [
 
340
  255
341
  ],
342
  "param_name": "g_shift_limit",
343
+ "type": "num_interval"
344
  },
345
  {
346
  "defaults": [
 
352
  255
353
  ],
354
  "param_name": "b_shift_limit",
355
+ "type": "num_interval"
356
  }
357
  ],
358
  "RandomBrightness": [
 
366
  1.0
367
  ],
368
  "param_name": "limit",
369
+ "type": "num_interval"
370
  }
371
  ],
372
  "RandomContrast": [
 
380
  1.0
381
  ],
382
  "param_name": "limit",
383
+ "type": "num_interval"
384
  }
385
  ],
386
  "RandomFog": [
 
406
  1.0
407
  ],
408
  "param_name": "alpha_coef",
409
+ "type": "num_interval"
410
  }
411
  ],
412
  "RandomGridShuffle": [
 
430
  "height",
431
  "width"
432
  ],
433
+ "type": "several_nums"
434
  }
435
  ],
436
  "RandomScale": [
 
444
  2.0
445
  ],
446
  "param_name": "scale_limit",
447
+ "type": "num_interval"
448
  },
449
  {
450
  "options_list": [
 
481
  5.0
482
  ],
483
  "param_name": "brightness_coeff",
484
+ "type": "num_interval"
485
  }
486
  ],
487
  "Solarize": [
 
492
  255
493
  ],
494
  "param_name": "threshold",
495
+ "type": "num_interval"
496
  }
497
  ],
498
  "ToGray": [],
src/control.py CHANGED
@@ -3,7 +3,7 @@ import streamlit as st
3
  # TODO: rename and refactor everything
4
 
5
 
6
- def select_int_interval(param_name: str, limits_list: list, defaults, **kwargs):
7
  st.sidebar.subheader(param_name)
8
  min_max_interval = st.sidebar.slider(
9
  "", limits_list[0], limits_list[1], defaults, key=hash(param_name)
@@ -11,7 +11,7 @@ def select_int_interval(param_name: str, limits_list: list, defaults, **kwargs):
11
  return min_max_interval
12
 
13
 
14
- def select_several_ints(
15
  param_name, subparam_names, limits_list, defaults_list, **kwargs
16
  ):
17
  st.sidebar.subheader(param_name)
@@ -45,7 +45,7 @@ def select_min_max(param_name, limits_list, defaults_list, min_diff=0, **kwargs)
45
 
46
 
47
  def select_RGB(param_name, **kwargs):
48
- result = select_several_ints(
49
  param_name,
50
  subparam_names=["Red", "Green", "Blue"],
51
  limits_list=[[0, 255], [0, 255], [0, 255]],
@@ -68,8 +68,8 @@ def select_checkbox(param_name, defaults, **kwargs):
68
 
69
  # dict from param name to function showing this param
70
  param2func = {
71
- "int_interval": select_int_interval,
72
- "several_ints": select_several_ints,
73
  "radio": select_radio,
74
  "rgb": select_RGB,
75
  "checkbox": select_checkbox,
 
3
  # TODO: rename and refactor everything
4
 
5
 
6
+ def select_num_interval(param_name: str, limits_list: list, defaults, **kwargs):
7
  st.sidebar.subheader(param_name)
8
  min_max_interval = st.sidebar.slider(
9
  "", limits_list[0], limits_list[1], defaults, key=hash(param_name)
 
11
  return min_max_interval
12
 
13
 
14
+ def select_several_nums(
15
  param_name, subparam_names, limits_list, defaults_list, **kwargs
16
  ):
17
  st.sidebar.subheader(param_name)
 
45
 
46
 
47
  def select_RGB(param_name, **kwargs):
48
+ result = select_several_nums(
49
  param_name,
50
  subparam_names=["Red", "Green", "Blue"],
51
  limits_list=[[0, 255], [0, 255], [0, 255]],
 
68
 
69
  # dict from param name to function showing this param
70
  param2func = {
71
+ "num_interval": select_num_interval,
72
+ "several_nums": select_several_nums,
73
  "radio": select_radio,
74
  "rgb": select_RGB,
75
  "checkbox": select_checkbox,