Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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,
Expand All @@ -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
Expand Down Expand Up @@ -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):
Expand Down