mindspore.dataset.deserialize
- mindspore.dataset.deserialize(input_dict=None, json_filepath=None)[source]
Construct dataset pipeline from a JSON file produced by de.serialize().
Note
Currently Python function deserialization of map operator are not supported.
- Parameters
- Returns
de.Dataset or None if error occurs.
- Raises
OSError – Can not open the JSON file.
Examples
>>> dataset = ds.MnistDataset(mnist_dataset_dir, 100) >>> one_hot_encode = c_transforms.OneHot(10) # num_classes is input argument >>> dataset = dataset.map(operation=one_hot_encode, input_column_names="label") >>> dataset = dataset.batch(batch_size=10, drop_remainder=True) >>> # Use case 1: to/from JSON file >>> ds.engine.serialize(dataset, json_filepath="/path/to/mnist_dataset_pipeline.json") >>> dataset = ds.engine.deserialize(json_filepath="/path/to/mnist_dataset_pipeline.json") >>> # Use case 2: to/from Python dictionary >>> serialized_data = ds.engine.serialize(dataset) >>> dataset = ds.engine.deserialize(input_dict=serialized_data)