Function mindspore::dataset::WIDERFace
Defined in File datasets.h
Function Documentation
Function to create a WIDERFace Dataset.
Note
When usage is “train”, “valid” or “all”, the generated dataset has eight columns [“image”, “bbox”, “blur”, “expression”, “illumination”, “occlusion”, “pose”, “invalid”]. When usage is “test”, it only has one column [“image”].
- Parameters
dataset_dir – [in] Path to the root directory that contains the dataset.
usage – [in] The type of data to be read, can be “train”, “test”, “valid” or “all” (default=”all”). “all” will read samples from “train” and “valid”.
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 WIDERFaceDataset.
样例/* Define dataset path and MindData object */ std::string folder_path = "/path/to/wider_face_dataset_directory"; std::shared_ptr<Dataset> ds = WIDERFace(folder_path, "train", std::make_shared<SequentialSampler>(0, 2)); /* Create iterator to read dataset */ std::shared_ptr<Iterator> iter = ds->CreateIterator(); std::unordered_map<std::string, mindspore::MSTensor> row; iter->GetNextRow(&row); /* Note: In WIDERFace dataset, if task='test', each dictionary has key "image" */ /* Note: In WIDERFace dataset, if task='all', 'train' or 'valid', each dictionary has keys "image", "bbox", * "blur", "expression", "illumination", "occlusion", "pose", "invalid" */ auto image = row["image"];