Function mindspore::dataset::Album
Defined in File datasets.h
Function Documentation
Function to create an AlbumDataset.
- Example
/* Define dataset path and MindData object */ std::string folder_path = "/path/to/album_dataset_directory"; std::string schema_file = "/path/to/album_schema_file"; std::vector<std::string> column_names = {"image", "label", "id"}; std::shared_ptr<Dataset> ds = Album(folder_path, schema_file, column_names); /* Create iterator to read dataset */ std::shared_ptr<Iterator> iter = ds->CreateIterator(); std::unordered_map<std::string, mindspore::MSTensor> row; iter->GetNextRow(&row); /* Note: As we defined before, each data dictionary owns keys "image", "label" and "id" */ auto image = row["image"];
Note
The generated dataset is specified through setting a schema
- Parameters
dataset_dir – [in] Path to the root directory that contains the dataset
data_schema – [in] Path to dataset schema file
column_names – [in] Column names used to specify columns to load, if empty, will read all columns. (default = {})
decode – [in] the option to decode the images in dataset (default = false)
sampler – [in] Shared pointer to a sampler object used to choose samples from the dataset. If sampler is not given, a
RandomSampler
will be used to randomly iterate the entire dataset (default = RandomSampler())cache – [in] Tensor cache to use. (default=nullptr which means no cache is used).
- Returns
Shared pointer to the current Dataset