Closed fstroth closed 3 years ago
Dear @fstroth,
You can built your visualization using BaseVisualization Callback. Check out this code: https://github.com/PyTorchLightning/lightning-flash/blob/master/flash/image/classification/data.py#L106
On the DataModule, just need to override the configure_data_fetcher
or provide a data_fetcher
will instantiating a DataModule.
class ImageClassificationData(DataModule):
"""Data module for image classification tasks."""
preprocess_cls = ImageClassificationPreprocess
def set_block_viz_window(self, value: bool) -> None:
"""Setter method to switch on/off matplotlib to pop up windows."""
self.data_fetcher.block_viz_window = value
@staticmethod
def configure_data_fetcher(*args, **kwargs) -> BaseDataFetcher:
return MatplotlibVisualization(*args, **kwargs)
Best, T.C
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
🚀 Feature
I would like to add some visualizations to the task specific datamodules. For example for the classifications tasks a histogram of the occurrences for each class.
Motivation
The plots would be of interest from an exploratory standpoint if one reads in new data with a data module and than wants to refine the dataset. As for real world datasets one often has to create plots of different distributions for the dataset to look for skewness in the class distribution and many other things. Furthermore, when someone uses a data source prepared by someone else it would be an easy way to get some insight into a dataset.
Pitch
Extend the datamodule with plotting functions that are specific to the different tasks. This could be done as plotting functions implemented in each datamodule definition or as a separate class which is a mixin for the datamodules.
Additional context
I would like to discuss if that feature would be of interest and what would be the best way to go about it. Once a conclusion is reached I can implement it than.