File size: 1,144 Bytes
66ec950 d5465e6 66ec950 d5465e6 b30ce1c d5465e6 6e7a74d 66ec950 b30ce1c d5465e6 b30ce1c d5465e6 87fe461 d5465e6 6e7a74d d5465e6 6e61d26 d5465e6 6e7a74d b30ce1c d5465e6 b30ce1c 6e7a74d b30ce1c 6e61d26 d5465e6 6e61d26 6e7a74d d5465e6 |
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 |
import streamlit as st
import albumentations as A
from utils import (
load_augmentations_config,
get_params_string
)
from visuals import (
show_transform_control,
select_image,
show_credentials,
show_docstring,
)
# show title
st.title("Demo of Albumentations transforms")
# select image
image = select_image(path_to_images="images")
# load the config
augmentations = load_augmentations_config("configs/augmentations.json")
# select a transformation
transform_name = st.sidebar.selectbox(
"Select a transformation:", sorted(list(augmentations.keys()))
)
# select the params values
param_values = show_transform_control(augmentations[transform_name])
# apply the transformation to the image
transform = getattr(A, transform_name)(**param_values)
augmented_image = transform(image=image)["image"]
# show the params passed
st.text("Params passed:" + get_params_string(param_values))
st.text("Press R to update")
# show the images
st.image(
[image, augmented_image],
caption=["Original image", "Transformed image"],
width=320,
)
# print additional info
show_docstring(transform)
show_credentials()
|