|View source on GitHub|
A generic dataset class for loading model training and evaluation dataset.
mediapipe_model_maker.quantization.ds.Dataset( tf_dataset: tf.data.Dataset, size: Optional[int] = None )
For each ML task, such as image classification, text classification etc., a subclass can be derived from this class to provide task-specific data loading utilities.
gen_tf_dataset( batch_size: int = 1, is_training: bool = False, shuffle: bool = False, preprocess: Optional[Callable[..., Any]] = None, drop_remainder: bool = False ) -> tf.data.Dataset
Generates a batched tf.data.Dataset for training/evaluation.
||An integer, the returned dataset will be batched by this size.|
||A boolean, when True, the returned dataset will be optionally shuffled and repeated as an endless dataset.|
||A boolean, when True, the returned dataset will be shuffled to create randomness during model training.|
||A function taking three arguments in order, feature, label and boolean is_training.|
||boolean, whether the finally batch drops remainder.|
|A TF dataset ready to be consumed by Keras model.|
split( fraction: float ) -> Tuple[_DatasetT, _DatasetT]
Splits dataset into two sub-datasets with the given fraction.
Primarily used for splitting the data set into training and testing sets.
||A float value defines the fraction of the first returned subdataset in the original data.|
|The splitted two sub datasets.|
Returns the number of element of the dataset.