"In deep learning tasks, a lot of data is need to train DNN model, when the dataset is not big enough, data augmentation should be applied.\n",
"\n",
"keras.preprocessing.image.ImageDataGenerator is a data generator, which can feed the DNN with data like : (data,label), it can also do data augmentation at the same time.\n",
"\n",
"It is very convenient for us to use keras.preprocessing.image.ImageDataGenerator to do data augmentation by implement image rotation, shift, rescale and so on... see [keras documentation](https://keras.io/preprocessing/image/) for detail.\n",
"\n",
"For image segmentation tasks, the image and mask must be transformed **together!!**"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## define your data generator\n",
"\n",
"If you want to visualize your data augmentation result, set save_to_dir = your path"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [],
"source": [
"#if you don't want to do data augmentation, set data_gen_args as an empty dict.\n",