I'm training 2 different CNN (custom and transfer learning) for an image classification problem. I use the same generator for both models. The dataset contains 5000 samples for 5 classes, but is imbalanced.
Here's the custom model I'm using.
def __init__(self, transfer_learning = False, lambda_reg = 0.001, drop_out_rate = 0.1):
if(transfer_learning == False):
self.model = Sequential();
self.model.add(Conv2D(32, (3,3), input_shape = (224,224,3), activation = "relu"))
self.model.add(MaxPooling2D(pool_size = (2,2)))
self.model.add(Conv2D(64, (1,1), activation = "relu"))
self.model.add(MaxPooling2D(pool_size = (2,2)))
self.model.add(Conv2D(128, (3,3), activation = "relu"))
self.model.add(MaxPooling2D(pool_size = (2,2)))
self.model.add(Conv2D(128, (1,1), activation = "relu"))
self.model.add(MaxPooling2D(pool_size = (2,2)))
self.model.add(Flatten())
self.model.add(Dense(512))
self.model.add(Dropout(drop_out_rate))
self.model.add(Dense(256))
self.model.add(Dropout(drop_out_rate))
self.model.add(Dense(5, activation = "softmax"))
So I can't understand the relation between steps_per_epoch
and batch_size
.
batch_size
is the number of samples the generator sends.
But is steps_per_epoch
the number of batch_size
to complete one training epoch?
If so, then it should be: steps_per_epoch = total_samples/batch_size
?
Whatever value I try, I always get the same problem (on both models), the val_acc
seems to reach a local optima.