edflow.util.edexplore module¶
Summary¶
Functions:
Displays flow colored image and histogram in streamlit |
|
Display flow vectors on image in streamlit |
|
Find first item in iterable containing part of the string |
|
Heuristic if item could be displayed as an optical flow field |
|
Heuristic if item could be displayed as an image |
|
Heuristic if item could be displayed as a segmentation mask |
|
Heuristic if item could be displayed as text |
|
Displays streamlit selectbox for selecting a value by key from list or dict |
Reference¶
-
edflow.util.edexplore.isimage(obj)[source]¶ Heuristic if item could be displayed as an image
- Parameters
obj (Any) – item
- Returns
Returns True for rank-three numpy arrays where third axis is one, three or, four. And for rank-two arrays if both sides are bigger than 4.
- Return type
bool
-
edflow.util.edexplore.isflow(obj)[source]¶ Heuristic if item could be displayed as an optical flow field
- Parameters
obj (Any) – item
- Returns
Returns True for rank-three numpy arrays where third axis is two.
- Return type
bool
-
edflow.util.edexplore.issegmentation(obj)[source]¶ Heuristic if item could be displayed as a segmentation mask
- Parameters
obj (Any) – item
- Returns
Returns True for rank-three numpy arrays with values boolean or in [0,1]
- Return type
bool
Warning
This heuristic catches quite a lot of cases, which could include non-segmentation masks. Only use it for interactive display where users can manually select other display types.
-
edflow.util.edexplore.istext(obj)[source]¶ Heuristic if item could be displayed as text
- Parameters
obj (Any) – item
- Returns
Retruns True for items of type int, float, str, np.integer, np.float
- Return type
bool
-
edflow.util.edexplore.display_flow(obj, key='flow values')[source]¶ Displays flow colored image and histogram in streamlit
- Parameters
obj (np.ndarray) – Optical flow field
key (str, optional) – Title of the histogram, by default “flow values”
-
edflow.util.edexplore.first_index(keys, key_part)[source]¶ Find first item in iterable containing part of the string
- Parameters
keys (Iterable[str]) – Iterable with strings to search through
key_part (str) – String to look for
- Returns
Returns index of first element in keys containing key_part, 0 if not found.
- Return type
int
-
edflow.util.edexplore.st_get_list_or_dict_item(list_or_dict, item_key, description=None, filter_fn=<function <lambda>>, config=None, config_key=None, selectbox_key=None)[source]¶ Displays streamlit selectbox for selecting a value by key from list or dict
- Parameters
list_or_dict (Union[list, dict]) – List or dict to find item in
item_key (str) – Key how item too look for is most likely called
description (str, optional) – Description for streamlit selectbox, by default last part of config_key or item key
filter_fn (callable, optional) – Function to check if item is desired, by default lambda ex_item:True
config (dict, optional) – Config for default values, by default None
config_key (str, optional) – How to find default value in config, by default None
selectbox_key (str, optional) – Key passed to streamlit.selectbox
- Returns
item, item_key for item found in dict or list
- Return type
Tuple[Any, str]
-
edflow.util.edexplore.display_flow_on_image(ex, config)[source]¶ Display flow vectors on image in streamlit
Add config for this visualization to your config file to enable this visualization by default.
Examples
Add visualizations to the text box with their import path. For example:
edexplore: visualizations: optical_flow_on_image: image_key: "images/0/image" flow_key: "forward_flow" vector_frequency: 5 flow_downsample_method: max_magnitude
- Parameters
ex (dict) – Example dict from dataset
config (dict) – Config dict