Dataset library for face stylizer fine tuning.
Inherits From: ClassificationDataset
, Dataset
mediapipe_model_maker
.
face_stylizer
.
Dataset
(
dataset
:
tf
.
data
.
Dataset
,
label_names
:
List
[
str
],
size
:
Optional
[
int
]
=
None
)
Args
input_data
means the raw input data, like an image, a text etc., while
the target
means the ground truth of the raw input data, e.g. the
classification label of the image etc.
Methods
from_image
@classmethodfrom_image ( filename : str ) ->mediapipe_model_maker . face_stylizer . dataset . classification_dataset . ClassificationDataset
Creates a dataset from single image.
Supported input image formats include 'jpg', 'jpeg', 'png'.
filename
gen_tf_dataset
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.
batch_size
is_training
shuffle
preprocess
drop_remainder
split
split
(
fraction
:
float
)
->
Tuple
[
ds
.
_DatasetT
,
ds
.
_DatasetT
]
Splits dataset into two sub-datasets with the given fraction.
Primarily used for splitting the data set into training and testing sets.
fraction
__len__
__len__
()
->
int
Returns the number of element of the dataset.
If size is not set, this method will fallback to using the lenmethod of the tf.data.Dataset in self._dataset. Calling lenon a tf.data.Dataset instance may throw a TypeError because the dataset may be lazy-loaded with an unknown size or have infinite size.
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, and the _size instance variable will be already set.


