2

I am newbie to Deep Learning. I have one basic doubt. It might sound stupid for you.
I am working on Road Extraction from Satellite Images. I have 1080 sample images only. That's why I applied Data Augmentation.

Following is the code for Data Augmentation

aug = ImageDataGenerator(rotation_range=10,
zoom_range=0.15,
horizontal_flip=True,
fill_mode="nearest")

All these 3 properties namely rotation_range, zoom_range and horizontal_flip will apply separately. I mean I will get one rotational image, one zoomed image and one horizontally flipped image. Am I guessing it right?

len(trainX)  # output 875

Now, I am fitting my training data on my model

batch_size = 4
epochs = 10
roadModel_train = roadModel.fit(
    x=aug.flow(trainX, trainY, batch_size=batch_size),
    validation_data=(validX, validY),
    epochs=epochs,
  verbose=1,steps_per_epoch=len(trainX)//batch_size)

My output:

enter image description here

My question is, what does this 218 denotes? I know that, it denotes total number of sample(or image in my case) in general.

But what it denotes when we apply Data Augmentation? Does it taking 218 images or it is taking 218 * 3(applied properties in data augmentation) = 654 images?

Pixel size of my dataset image is 10m. Then how should I augment the data? Which properties should I apply?

I would be more than happy for your help!

Thanks in advance!

Harsh Dhamecha
  • 116
  • 3
  • 12

1 Answers1

2

In your roadModel.fit(), you set 4 as a batch size. This means that 4 images are taken for each batch and the loss is calculated from that batch. It takes 218 steps to get every image in the training set.

If we take 218*4 we get 872. The length of your training set is 875, so that makes sense.

Batching is used to limit the amount of RAM necessary to run the network. I would recommend setting the batch_size=35 in this case because that would result in 25 steps per epoch.

The ImageDataGenerator augmentations are randomly applied to each image. Based on your parameters, some will be flipped and some will zoom up to 1.15x.

I hope this answers your question.

More details for all augmentations can be found here

theastronomist
  • 955
  • 2
  • 13
  • 33