mindspore.dataset

This module provides APIs to load and process various common datasets such as MNIST, CIFAR-10, CIFAR-100, VOC, COCO, ImageNet, CelebA, CLUE, etc. It also supports datasets in standard format, including MindRecord, TFRecord, Manifest, etc. Users can also define their own datasets with this module.

Besides, this module provides APIs to sample data while loading.

We can enable cache in most of the dataset with its key arguments ‘cache’. Please notice that cache is not supported on Windows platform yet. Do not use it while loading and processing data on Windows. More introductions and limitations can refer Single-Node Tensor Cache.

Common imported modules in corresponding API examples are as follows:

import mindspore.dataset as ds
from mindspore.dataset.transforms import c_transforms

Descriptions of common dataset terms are as follows:

  • Dataset, the base class of all the datasets. It provides data processing methods to help preprocess the data.

  • SourceDataset, an abstract class to represent the source of dataset pipeline which produces data from data sources such as files and databases.

  • MappableDataset, an abstract class to represent a source dataset which supports for random access.

  • Iterator, the base class of dataset iterator for enumerating elements.

Vision

mindspore.dataset.Caltech101Dataset

A source dataset that reads and parses Caltech101 dataset.

mindspore.dataset.Caltech256Dataset

A source dataset that reads and parses Caltech256 dataset.

mindspore.dataset.CelebADataset

A source dataset that reads and parses CelebA dataset.

mindspore.dataset.Cifar10Dataset

A source dataset that reads and parses Cifar10 dataset.

mindspore.dataset.Cifar100Dataset

A source dataset that reads and parses Cifar100 dataset.

mindspore.dataset.CityscapesDataset

A source dataset that reads and parses Cityscapes dataset.

mindspore.dataset.CocoDataset

A source dataset that reads and parses COCO dataset.

mindspore.dataset.DIV2KDataset

A source dataset that reads and parses DIV2KDataset dataset.

mindspore.dataset.EMnistDataset

A source dataset that reads and parses the EMNIST dataset.

mindspore.dataset.FakeImageDataset

A source dataset for generating fake images.

mindspore.dataset.FashionMnistDataset

A source dataset that reads and parses the FASHION-MNIST dataset.

mindspore.dataset.FlickrDataset

A source dataset that reads and parses Flickr8k and Flickr30k dataset.

mindspore.dataset.Flowers102Dataset

A source dataset that reads and parses Flowers102 dataset.

mindspore.dataset.ImageFolderDataset

A source dataset that reads images from a tree of directories.

mindspore.dataset.KMnistDataset

A source dataset that reads and parses the KMNIST dataset.

mindspore.dataset.ManifestDataset

A source dataset for reading images from a Manifest file.

mindspore.dataset.MnistDataset

A source dataset that reads and parses the MNIST dataset.

mindspore.dataset.PhotoTourDataset

A source dataset that reads and parses the PhotoTour dataset.

mindspore.dataset.Places365Dataset

A source dataset that reads and parses the Places365 dataset.

mindspore.dataset.QMnistDataset

A source dataset that reads and parses the QMNIST dataset.

mindspore.dataset.SBDataset

A source dataset that reads and parses Semantic Boundaries Dataset.

mindspore.dataset.SBUDataset

A source dataset that reads and parses the SBU dataset.

mindspore.dataset.SemeionDataset

A source dataset that reads and parses Semeion dataset.

mindspore.dataset.STL10Dataset

A source dataset that reads and parses STL10 dataset.

mindspore.dataset.SVHNDataset

A source dataset that reads and parses SVHN dataset.

mindspore.dataset.USPSDataset

A source dataset that reads and parses the USPS dataset.

mindspore.dataset.VOCDataset

A source dataset that reads and parses VOC dataset.

mindspore.dataset.WIDERFaceDataset

A source dataset that reads and parses WIDERFace dataset.

Text

mindspore.dataset.AGNewsDataset

A source dataset that reads and parses AG News datasets.

mindspore.dataset.AmazonReviewDataset

A source dataset that reads and parses Amazon Review Polarity and Amazon Review Full datasets.

mindspore.dataset.CLUEDataset

A source dataset that reads and parses CLUE datasets.

mindspore.dataset.CoNLL2000Dataset

A source dataset that reads and parses CoNLL2000 dataset.

mindspore.dataset.CSVDataset

A source dataset that reads and parses comma-separated values (CSV) files as dataset.

mindspore.dataset.DBpediaDataset

A source dataset that reads and parses the DBpedia dataset.

mindspore.dataset.EnWik9Dataset

A source dataset that reads and parses EnWik9 dataset.

mindspore.dataset.IMDBDataset

A source dataset that reads and parses Internet Movie Database (IMDb).

mindspore.dataset.IWSLT2016Dataset

A source dataset that reads and parses IWSLT2016 datasets.

mindspore.dataset.IWSLT2017Dataset

A source dataset that reads and parses IWSLT2017 datasets.

mindspore.dataset.PennTreebankDataset

A source dataset that reads and parses PennTreebank datasets.

mindspore.dataset.SogouNewsDataset

A source dataset that reads and parses Sogou News dataset.

mindspore.dataset.TextFileDataset

A source dataset that reads and parses datasets stored on disk in text format.

mindspore.dataset.UDPOSDataset

A source dataset that reads and parses UDPOS dataset.

mindspore.dataset.WikiTextDataset

A source dataset that reads and parses WikiText2 and WikiText103 datasets.

mindspore.dataset.YahooAnswersDataset

A source dataset that reads and parses the YahooAnswers dataset.

mindspore.dataset.YelpReviewDataset

A source dataset that reads and parses Yelp Review Polarity and Yelp Review Full dataset.

Audio

mindspore.dataset.LJSpeechDataset

A source dataset that reads and parses LJSpeech dataset.

mindspore.dataset.SpeechCommandsDataset

A source dataset that reads and parses the SpeechCommands dataset.

mindspore.dataset.TedliumDataset

A source dataset that reads and parses Tedlium dataset.

mindspore.dataset.YesNoDataset

A source dataset that reads and parses the YesNo dataset.

Standard Format

mindspore.dataset.CSVDataset

A source dataset that reads and parses comma-separated values (CSV) files as dataset.

mindspore.dataset.MindDataset

A source dataset that reads and parses MindRecord dataset.

mindspore.dataset.TFRecordDataset

A source dataset that reads and parses datasets stored on disk in TFData format.

User Defined

mindspore.dataset.GeneratorDataset

A source dataset that generates data from Python by invoking Python data source each epoch.

mindspore.dataset.NumpySlicesDataset

Creates a dataset with given data slices, mainly for loading Python data into dataset.

mindspore.dataset.PaddedDataset

Creates a dataset with filler data provided by user.

mindspore.dataset.RandomDataset

A source dataset that generates random data.

Graph

mindspore.dataset.GraphData

Reads the graph dataset used for GNN training from the shared file and database.

Sampler

mindspore.dataset.DistributedSampler

A sampler that accesses a shard of the dataset, it helps divide dataset into multi-subset for distributed training.

mindspore.dataset.PKSampler

Samples K elements for each P class in the dataset.

mindspore.dataset.RandomSampler

Samples the elements randomly.

mindspore.dataset.SequentialSampler

Samples the dataset elements sequentially that is equivalent to not using a sampler.

mindspore.dataset.SubsetRandomSampler

Samples the elements randomly from a sequence of indices.

mindspore.dataset.SubsetSampler

Samples the elements from a sequence of indices.

mindspore.dataset.WeightedRandomSampler

Samples the elements from [0, len(weights) - 1] randomly with the given weights (probabilities).

Others

mindspore.dataset.BatchInfo

Only the batch size function and per_batch_map of the batch operator can dynamically adjust parameters based on the number of batches and epochs during training.

mindspore.dataset.DatasetCache

A client to interface with tensor caching service.

mindspore.dataset.DSCallback

Abstract base class used to build a dataset callback class.

mindspore.dataset.SamplingStrategy

Specifies the sampling strategy when execute get_sampled_neighbors.

mindspore.dataset.Schema

Class to represent a schema of a dataset.

mindspore.dataset.Shuffle

Specify the shuffle mode.

mindspore.dataset.WaitedDSCallback

Abstract base class used to build a dataset callback class that is synchronized with the training callback.

mindspore.dataset.OutputFormat

Specifies the output storage format when execute get_all_neighbors.

mindspore.dataset.compare

Compare if two dataset pipelines are the same.

mindspore.dataset.deserialize

Construct dataset pipeline from a JSON file produced by de.serialize().

mindspore.dataset.serialize

Serialize dataset pipeline into a JSON file.

mindspore.dataset.show

Write the dataset pipeline graph to logger.info file.

mindspore.dataset.utils.imshow_det_bbox

Draw an image with given bboxes and class labels (with scores).

mindspore.dataset.zip

Zip the datasets in the input tuple of datasets.