mindspore.dataset.Dataset.num_classes

Dataset.num_classes()[source]

Get the number of classes in a dataset.

Returns

int, number of classes.

Examples

>>> # dataset is an instance object of Dataset
>>> num_classes = dataset.num_classes()