diff --git a/tensorflow_examples/lite/model_maker/core/data_util/dataloader.py b/tensorflow_examples/lite/model_maker/core/data_util/dataloader.py index b03a3cb7f54..f2277925d6f 100644 --- a/tensorflow_examples/lite/model_maker/core/data_util/dataloader.py +++ b/tensorflow_examples/lite/model_maker/core/data_util/dataloader.py @@ -53,7 +53,7 @@ def __init__(self, dataset, size=None): `input_data` means the raw input data, like an image, a text etc., while the `target` means some ground truth of the raw input data, such as the classification label of the image etc. - size: The size of the dataset. tf.data.Dataset donesn't support a function + size: The size of the dataset. tf.data.Dataset doesn't support a function to get the length directly since it's lazy-loaded and may be infinite. """ self._dataset = dataset @@ -63,9 +63,9 @@ def __init__(self, dataset, size=None): def size(self) -> Optional[int]: """Returns the size of the dataset. - Note that this function may return None becuase the exact size of the + Note that this function may return None because the exact size of the dataset isn't a necessary parameter to create an instance of this class, - and tf.data.Dataset donesn't support a function to get the length directly + and tf.data.Dataset doesn't support a function to get the length directly since it's lazy-loaded and may be infinite. In most cases, however, when an instance of this class is created by helper functions like 'from_folder', the size of the dataset will be preprocessed, @@ -83,7 +83,7 @@ def gen_dataset(self, """Generate a shared and batched tf.data.Dataset for training/evaluation. Args: - batch_size: A integer, the returned dataset will be batched by this size. + batch_size: An integer, the returned dataset will be batched by this size. is_training: A boolean, when True, the returned dataset will be optionally shuffled and repeated as an endless dataset. shuffle: A boolean, when True, the returned dataset will be shuffled to @@ -180,6 +180,7 @@ def __init__(self, dataset, size, index_to_label): @property def num_classes(self): + """Returns the number of classes of the dataset.""" return len(self.index_to_label) def split(self, fraction):