mindspore.dataset.Dataset.get_class_indexing

Dataset.get_class_indexing()[source]

Return the class index.

Returns

dict, a str-to-int mapping from label name to index. dict, a str-to-list<int> mapping from label name to index for Coco ONLY. The second number in the list is used to indicate the super category.

Examples

>>> import mindspore.dataset as ds
>>> # Read image files
>>> image_folder_dataset_dir = "/path/to/image_folder_dataset_directory"
>>> dataset = ds.ImageFolderDataset(dataset_dir=image_folder_dataset_dir)
>>> # Check how many classes exist in image folder
>>> class_indexing = dataset.get_class_indexing()