diff --git a/tutorials/source_en/use/data_preparation/data_processing_and_augmentation.md b/tutorials/source_en/use/data_preparation/data_processing_and_augmentation.md index 3a861abe2aa70f8958338d5e1eae328f2afbb7d8..f11336ee404fb2c2b1a2c347e3c1897dc762899b 100644 --- a/tutorials/source_en/use/data_preparation/data_processing_and_augmentation.md +++ b/tutorials/source_en/use/data_preparation/data_processing_and_augmentation.md @@ -282,6 +282,8 @@ Data augmentation requires the `map` function. For details about how to use the ``` 2. Define data augmentation operators. The following uses `Resize` as an example: ```python + # path to imagefolder directory. This directory needs to contain sub-directories which contain the images + DATA_DIR = "/path/to/imagefolder_directory" dataset = ds.ImageFolderDatasetV2(DATA_DIR, decode=True) # Decode images. resize_op = transforms.Resize(size=(500,500), interpolation=Inter.LINEAR) dataset.map(input_columns="image", operations=resize_op) @@ -308,6 +310,8 @@ Figure 2: Image after its size is reset ``` 2. Define data augmentation operators and use the `ComposeOp` API to combine multiple data augmentation operations. The following uses `RandomCrop` as an example: ```python + # path to imagefolder directory. This directory needs to contain sub-directories which contain the images + DATA_DIR = "/path/to/imagefolder_directory" dataset = ds.ImageFolderDatasetV2(DATA_DIR) transforms_list = [ diff --git a/tutorials/source_zh_cn/use/data_preparation/data_processing_and_augmentation.md b/tutorials/source_zh_cn/use/data_preparation/data_processing_and_augmentation.md index 277da870e0a11c091e294d1b61ccc7da0cbb9c5d..c4ff2c70079775bfe7cd26cf113a61cd591b84cd 100644 --- a/tutorials/source_zh_cn/use/data_preparation/data_processing_and_augmentation.md +++ b/tutorials/source_zh_cn/use/data_preparation/data_processing_and_augmentation.md @@ -282,6 +282,8 @@ MindSpore提供`c_transforms`模块以及`py_transforms`模块函数供用户进 ``` 2. 定义数据增强算子,以`Resize`为例: ```python + # path to imagefolder directory. This directory needs to contain sub-directories which contain the images + DATA_DIR = "/path/to/imagefolder_directory" dataset = ds.ImageFolderDatasetV2(DATA_DIR, decode=True) # Decode images. resize_op = transforms.Resize(size=(500,500), interpolation=Inter.LINEAR) dataset.map(input_columns="image", operations=resize_op) @@ -308,6 +310,8 @@ MindSpore提供`c_transforms`模块以及`py_transforms`模块函数供用户进 ``` 2. 定义数据增强算子,通过`ComposeOp`接口将多个数据增强组合使用, 以`RandomCrop`为例: ```python + # path to imagefolder directory. This directory needs to contain sub-directories which contain the images + DATA_DIR = "/path/to/imagefolder_directory" dataset = ds.ImageFolderDatasetV2(DATA_DIR) transforms_list = [