Function mindspore::dataset::Coco

Function Documentation

inline std::shared_ptr<CocoDataset> mindspore::dataset::Coco(const std::string &dataset_dir, const std::string &annotation_file, const std::string &task, const bool &decode, const std::reference_wrapper<Sampler> sampler, const std::shared_ptr<DatasetCache> &cache = nullptr, const bool &extra_metadata = false)

Function to create a CocoDataset.

Note

The generated dataset has multi-columns :

  • task=’Detection’, column: [[‘image’, dtype=uint8], [‘bbox’, dtype=float32], [‘category_id’, dtype=uint32], [‘iscrowd’, dtype=uint32]].

  • task=’Stuff’, column: [[‘image’, dtype=uint8], [‘segmentation’,dtype=float32], [‘iscrowd’, dtype=uint32]].

  • task=’Keypoint’, column: [[‘image’, dtype=uint8], [‘keypoints’, dtype=float32], [‘num_keypoints’, dtype=uint32]].

  • task=’Panoptic’, column: [[‘image’, dtype=uint8], [‘bbox’, dtype=float32], [‘category_id’, dtype=uint32], [‘iscrowd’, dtype=uint32], [‘area’, dtype=uitn32]].

Parameters
  • dataset_dir[in] Path to the root directory that contains the dataset.

  • annotation_file[in] Path to the annotation json.

  • task[in] Set the task type of reading coco data, now support ‘Detection’/’Stuff’/’Panoptic’/’Keypoint’.

  • decode[in] Decode the images after reading.

  • sampler[in] Sampler object used to choose samples from the dataset.

  • cache[in] Tensor cache to use (default=nullptr which means no cache is used).

  • extra_metadata[in] Flag to add extra meta-data to row. (default=false)

Returns

Shared pointer to the CocoDataset.