Supplies dashboards and dashboard components. Dashboards are defined as classes, to show the dashboard use the .show() function on an dashboard instance.
INFO     - The mmdet config folder already exists. No need to downloaded it. Path : /home/frederik/.icevision/mmdetection_configs/mmdetection_configs-2.20.1/configs | icevision.models.mmdet.download_configs:download_mmdet_configs:17

class Dashboard[source]

Dashboard(width:int=500, height:int=500) :: ABC

Abstract base class for dashboards. Requires the functions build_gui and show to be defined. build_gui should define the gui elements/plots for the dashboard and show should return a panel object that can be displayed. In most cases build_gui will call some other functions that return gui components and combine them into one element and than register the combined element as an attribute of the class (e.g. self.gui). In most cases the show function than returns the gui element defined in build_gui (e.g. self.gui).

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.

class BaseGallery[source]

BaseGallery(data, sort_cols=None, width=500, height=500) :: Dashboard

Base class for galleries that provieds the provides the basic interface for creating a gallery. Inheritied classes need to define at least two functions get_image_by_image_id and get_num_entries.

class RecordDastasetGallery[source]

RecordDastasetGallery(dataset, gallery_desciptor, img_id_col, sort_cols=None, width=500, height=500) :: BaseGallery

Creates a gallery for a dataset with sorting options. The dataset is required to provide a function get_image_by_image_id which returns an panel compativle representation of an image for a given id. The gallery_descriptor is a string, that is the name of the descriptor to use for getting the data to create the gallery with. The descriptor need to return a pandas dataframe. The img_id_col is the column that identifies the unique images (e.g. filepath of image id).

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"

class DatasetOverview[source]

DatasetOverview(dataset:GenericDataset, height:int=500, width:int=500) :: Dashboard

Provides a genric overview dashboard for datasets.

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()

class MultiDatasetOverview[source]

MultiDatasetOverview(datasets:Union[List[GenericDataset], ObservableList], height=100, width=1000, with_del_button=False) :: Dashboard

Same as the DatasetOverview dashboard but takes a list of datasets and presents the dataset stats in a table. The list of datasets can be expanded by adding new entryies to the datasets attribute or elements can be removed with the delete button.

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()

class DatasetComparison[source]

DatasetComparison(datasets:List[GenericDataset], height:int=500, width:int=500) :: Dashboard

Same as the DatasetOverview Dashboard but takes a list of datasets and presents there overviews next to each other.

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

class DatasetFilter[source]

DatasetFilter(dataset:GenericDataset, columns:Optional[List[str]]=None, height:int=500, width:int=500, filter_width:Optional[int]=None, filter_height:Optional[int]=None, n_cols:int=None) :: Dashboard

Abstract base class for generic filters on datasets. Allows for filtering of data using different controlls, for more on controlls see: plotting.controlls.

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.

class DatasetFilterWithRangeSliderAndMultiSelect[source]

DatasetFilterWithRangeSliderAndMultiSelect(dataset:GenericDataset, columns:Optional[List[str]]=None, height:int=500, width:int=500, filter_width:Optional[int]=None, filter_height:Optional[int]=None, n_cols:int=None) :: DatasetFilter

Abstract base class for generic filters on datasets. Allows for filtering of data using different controlls, for more on controlls see: plotting.controlls.

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()

class DatasetFilterWithScatter[source]

DatasetFilterWithScatter(dataset:GenericDataset, columns:Optional[List[str]]=None, height:int=500, width:int=500, filter_width:Optional[int]=None, filter_height:Optional[int]=None, n_cols:int=None) :: DatasetFilter

Abstract base class for generic filters on datasets. Allows for filtering of data using different controlls, for more on controlls see: plotting.controlls.

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()

class DatasetGenerator[source]

DatasetGenerator(dataset, with_dataset_overview=True, width=500, height=500) :: Dashboard

This dashboards can be used to generate datasets by filtering the data with filer dashboars.

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()

class DatasetGeneratorScatter[source]

DatasetGeneratorScatter(dataset, with_dataset_overview=True, width=500, height=500) :: DatasetGenerator

Same as DatasetGenerator but replaces the range slider + hists for the numerical columns with a sactter plot selection.

test_dataset_generator_scatter = DatasetGeneratorScatter(test_dataset, height=700, width=500)
test_dataset_generator_scatter.show()