Abstaract base class for dashboards. Inherited classes are required to implement a build_gui
function, that builds the gui to be shown as well as setting up interactions and a show
function that returns the gui. The build_gui
function is called at the end of the __init__
function. Most dashboards require different descriptors from the dataset (data, stats usw.). For simple handling of cases where the name is different (a vision dataset might have stats for the images, the annotations and the annotation classes) most dashboards have class variables for the different descriptors, wich can be changed to use a new descriptor.
For complexer dashboards, that use other dashboards as components the same approche is used, where class varibales are used to choose a implementation of a dashboard. With this, in most cases only certain parts need to be replaced and not everything.
Creates a gallery with the images of a dataset. The dataset is required to have the following method
:
get_image_by_image_id
: Takes an image_id, width and height; returns a bokeh figure or panel widget
And a gallery descriptor that returns a pd.Dataframe
that has at least one column named the same as the img_id_col
parameter. To use sorting of the images a list of cols can be provided via the sort_cols
parameter.
This requires for the images without sorting to be in the same order as the data returned by the
sort_descriptor
(This should be a given if the df is generated in sequence of the images)
test_gallery = RecordDastasetGallery(test_dataset, "gallery_data", "id", sort_cols=["label"])
test_gallery.update_sorting(None)
test_gallery.show()
test_gallery = RecordDastasetGallery(test_dataset, "data", sort_cols=["label", "objects_per_image"], img_id_col="id")
assert test_gallery.gui[1][0][0].object == "4 - Bird"
test_gallery.gui_image_selection_controlls[0].clicks += 1
test_gallery.gui_image_selection_controlls[0].clicks += 1
assert test_gallery.gui[1][0][0].object == "2 - Dog"
test_gallery.gui_image_selection_controlls[-1].clicks += 1
test_gallery.gui_image_selection_controlls[-1].clicks += 1
assert test_gallery.gui[1][0][0].object == "4 - Bird"
The dataset is required to have to following (default) descriptors
:
- data [pd.Dataframe]: Each row should be a singel datapoint/annotation
- stats [pd.Datagrame]: One row that describes the dataset, were the columns represent different information
test_dataset_overview = DatasetOverview(test_dataset, height=200)
test_dataset_overview.show()
The dataset is required to have to following descriptors
:
- stats [pd.Datagrame]: One row that descripbes the dataset, were the columns represent different information
test_multi_dataset_overview_without_del_button = MultiDatasetOverview([test_dataset, test_dataset], with_del_button=False)
test_multi_dataset_overview = MultiDatasetOverview([test_dataset, test_dataset], with_del_button=True)
test_multi_dataset_overview.delete_entry(0)
test_multi_dataset_overview.update_table(None)
test_multi_dataset_overview.show()
The dataset is required to have to following (default) descriptors
:
- data [pd.Dataframe]: Each row should be a singel datapoint/annotation
- stats [pd.Datagrame]: One row that describes the dataset, were the columns represent different information
test_dataset_overview = DatasetComparison([test_dataset, test_dataset], height=200)
test_dataset_overview.show()
from joblib import delayed, Parallel
Provides an abstarct baseclass for filter dashboards. Inherited classes are required to implement the generate_filters
method which generates a filter for each column of the df returned by the data
descriptor. The selection can be optained with the get_selection
method.
The dataset is required to have to following (default) descriptors
:
- data [pd.Dataframe]: Each row should be a singel datapoint/annotation with the columns pepresenting attributes to filter
For an example see: DatasetFilterWithRangeSliderAndMultiSelect
or the DatasetFilterWithScatter
.
The DatasetFilterWithRangeSliderAndMultiSelect
filter dashboard uses multiselects for categorical columns and range slider with histograms for numerical columns.
test_dataset_filter = DatasetFilterWithRangeSliderAndMultiSelect(test_dataset, height=350)
test_dataset_filter.register_callback(lambda x: None)
test_dataset_filter.update_plots(test_dataset_filter.get_selection())
test_dataset_filter.show()
The ScatterDatasetFilter
uses multiselects for categorical columns and a scatter plot selection for numerical columns.
test_dataset_filter = DatasetFilterWithScatter(test_dataset, height=700)
test_dataset_filter.show()
The dataset is required to have to following (default) descriptors
:
- data [pd.Datagrame]: Each row represents a datapoint
- stats [pd.Datagrame]: One row that descripbes the dataset, were the columns represent different information
Furthermore, the dataset set if required to have the following functions
:
- create_new_from_mask(class_instance, binary_mask): Class function that is called with a mask and an instance of the class, that returns a new instance
- save(save_path): Can be called with a path and save the dataset to that path
class dummy_event:
new = [0]
test_dataset_generator = DatasetGenerator(test_dataset, True, height=700, width=500)
test_dataset_generator.create_dataset(0)
test_dataset_generator.export_name_input.value = "test_ds"
test_dataset_generator.update_dataset_overview(dummy_event())
test_dataset_generator.export_path.value = "dump_dir"
shutil.rmtree("dump_dir", ignore_errors=True)
test_dataset_generator.export_datasets(0)
assert len(os.listdir("dump_dir")) == 0
shutil.rmtree("dump_dir")
test_dataset_generator.show()
test_dataset_generator_scatter = DatasetGeneratorScatter(test_dataset, height=700, width=500)
test_dataset_generator_scatter.show()