IliaLarchenko
commited on
Commit
•
bcb8af1
1
Parent(s):
87fe461
refactoring, new transforms
Browse files- configs/augmentations.json +38 -2
- src/__pycache__/control.cpython-37.pyc +0 -0
- src/control.py +21 -4
- src/main.py +1 -3
configs/augmentations.json
CHANGED
@@ -6,16 +6,52 @@
|
|
6 |
"Blur": [{"param_name" : "blur_limit",
|
7 |
"type" : "int_interval",
|
8 |
"limits_list" : [3, 100],
|
9 |
-
"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
10 |
],
|
11 |
"CLAHE": [{"param_name" : "clip_limit",
|
12 |
"type" : "int_interval",
|
13 |
"limits_list" : [1, 100],
|
14 |
-
"
|
15 |
{"param_name" : "tile_grid_size",
|
16 |
"type" : "several_ints",
|
17 |
"subparam_names": ["y", "x"],
|
18 |
"limits_list" : [[1, 100],[1, 100]],
|
19 |
"defaults_list" : [8, 8]}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
20 |
]
|
21 |
}
|
|
|
6 |
"Blur": [{"param_name" : "blur_limit",
|
7 |
"type" : "int_interval",
|
8 |
"limits_list" : [3, 100],
|
9 |
+
"defaults" : [3, 7]}
|
10 |
+
],
|
11 |
+
"JpegCompression": [{"param_name" : "quality_lower",
|
12 |
+
"type" : "int_interval",
|
13 |
+
"limits_list" : [0, 100],
|
14 |
+
"defaults" : 99},
|
15 |
+
{"param_name" : "quality_upper",
|
16 |
+
"type" : "int_interval",
|
17 |
+
"limits_list" : [0, 100],
|
18 |
+
"defaults" : 100}
|
19 |
+
],
|
20 |
+
"ImageCompression": [{"param_name" : "quality_lower",
|
21 |
+
"type" : "int_interval",
|
22 |
+
"limits_list" : [0, 100],
|
23 |
+
"defaults" : 99},
|
24 |
+
{"param_name" : "quality_upper",
|
25 |
+
"type" : "int_interval",
|
26 |
+
"limits_list" : [0, 100],
|
27 |
+
"defaults" : 100},
|
28 |
+
{"param_name" : "compression_type",
|
29 |
+
"type" : "radio",
|
30 |
+
"options_list" : [0, 1]}
|
31 |
],
|
32 |
"CLAHE": [{"param_name" : "clip_limit",
|
33 |
"type" : "int_interval",
|
34 |
"limits_list" : [1, 100],
|
35 |
+
"defaults" : [1, 4]},
|
36 |
{"param_name" : "tile_grid_size",
|
37 |
"type" : "several_ints",
|
38 |
"subparam_names": ["y", "x"],
|
39 |
"limits_list" : [[1, 100],[1, 100]],
|
40 |
"defaults_list" : [8, 8]}
|
41 |
+
],
|
42 |
+
"Cutout": [{"param_name" : "num_holes",
|
43 |
+
"type" : "int_interval",
|
44 |
+
"limits_list" : [1, 100],
|
45 |
+
"defaults" : 8},
|
46 |
+
{"param_name" : "max_h_size",
|
47 |
+
"type" : "int_interval",
|
48 |
+
"limits_list" : [1, 100],
|
49 |
+
"defaults" : 8},
|
50 |
+
{"param_name" : "max_w_size",
|
51 |
+
"type" : "int_interval",
|
52 |
+
"limits_list" : [1, 100],
|
53 |
+
"defaults" : 8},
|
54 |
+
{"param_name" : "fill_value",
|
55 |
+
"type" : "rgb"}
|
56 |
]
|
57 |
}
|
src/__pycache__/control.cpython-37.pyc
CHANGED
Binary files a/src/__pycache__/control.cpython-37.pyc and b/src/__pycache__/control.cpython-37.pyc differ
|
|
src/control.py
CHANGED
@@ -1,11 +1,12 @@
|
|
1 |
import streamlit as st
|
2 |
|
3 |
|
4 |
-
def select_int_interval(param_name, limits_list,
|
5 |
st.sidebar.subheader(param_name)
|
6 |
-
min_max_interval = st.sidebar.slider('', limits_list[0], limits_list[1],
|
7 |
return min_max_interval
|
8 |
|
|
|
9 |
def select_several_ints(param_name, subparam_names, limits_list, defaults_list, **kwargs):
|
10 |
st.sidebar.subheader(param_name)
|
11 |
result = []
|
@@ -13,13 +14,29 @@ def select_several_ints(param_name, subparam_names, limits_list, defaults_list,
|
|
13 |
assert len(subparam_names) == len(defaults_list)
|
14 |
|
15 |
for name, limits, defaults in zip(subparam_names, limits_list, defaults_list):
|
16 |
-
result.append(st.sidebar.slider(name, limits[0], limits[1], defaults))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
17 |
return tuple(result)
|
18 |
|
19 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
20 |
# dict from param name to function showing this param
|
21 |
param2func = {
|
22 |
'int_interval': select_int_interval,
|
23 |
'several_ints': select_several_ints,
|
24 |
-
|
|
|
|
|
25 |
}
|
|
|
1 |
import streamlit as st
|
2 |
|
3 |
|
4 |
+
def select_int_interval(param_name, limits_list, defaults, **kwargs):
|
5 |
st.sidebar.subheader(param_name)
|
6 |
+
min_max_interval = st.sidebar.slider('', limits_list[0], limits_list[1], defaults, key = hash(param_name))
|
7 |
return min_max_interval
|
8 |
|
9 |
+
|
10 |
def select_several_ints(param_name, subparam_names, limits_list, defaults_list, **kwargs):
|
11 |
st.sidebar.subheader(param_name)
|
12 |
result = []
|
|
|
14 |
assert len(subparam_names) == len(defaults_list)
|
15 |
|
16 |
for name, limits, defaults in zip(subparam_names, limits_list, defaults_list):
|
17 |
+
result.append(st.sidebar.slider(name, limits[0], limits[1], defaults, key = hash(param_name + name)))
|
18 |
+
return tuple(result)
|
19 |
+
|
20 |
+
def select_several_RGB(param_name, **kwargs):
|
21 |
+
result = select_several_ints(param_name,
|
22 |
+
subparam_names = ["Red", "Green", "Blue"],
|
23 |
+
limits_list = [[0, 255],[0, 255],[0, 255]],
|
24 |
+
defaults_list = [0, 0, 0])
|
25 |
return tuple(result)
|
26 |
|
27 |
|
28 |
+
|
29 |
+
def select_radio(param_name, options_list, **kwargs):
|
30 |
+
st.sidebar.subheader(param_name)
|
31 |
+
result = st.sidebar.radio('', options_list)
|
32 |
+
return result
|
33 |
+
|
34 |
+
|
35 |
# dict from param name to function showing this param
|
36 |
param2func = {
|
37 |
'int_interval': select_int_interval,
|
38 |
'several_ints': select_several_ints,
|
39 |
+
'radio': select_radio,
|
40 |
+
'rgb': select_several_RGB
|
41 |
+
|
42 |
}
|
src/main.py
CHANGED
@@ -62,6 +62,4 @@ st.text('')
|
|
62 |
st.subheader('Credentials:')
|
63 |
st.text('Source: https://github.com/IliaLarchenko/albumentations-demo')
|
64 |
st.text('Albumentation library: https://github.com/albumentations-team/albumentations')
|
65 |
-
st.text('Image Source: https://www.pexels.com/royalty-free-images/')
|
66 |
-
|
67 |
-
|
|
|
62 |
st.subheader('Credentials:')
|
63 |
st.text('Source: https://github.com/IliaLarchenko/albumentations-demo')
|
64 |
st.text('Albumentation library: https://github.com/albumentations-team/albumentations')
|
65 |
+
st.text('Image Source: https://www.pexels.com/royalty-free-images/')
|
|
|
|