mindspore.dataset.Dataset.get_class_indexing
- mindspore.dataset.Dataset.get_class_indexing()[源代码]
获取类别名称到类别索引的映射字典。
该字典可用于查询某一类别索引对应的是哪一个类别名称。
- 返回:
Dict[str, int],类别名称到类别索引的映射关系。
样例:
>>> 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()