In [11]:
model.compile(loss='binary_crossentropy',
              optimizer='adam',
              metrics=['accuracy'])
In [12]:
train_datagen = ImageDataGenerator(rescale=1./255)
val_datagen = ImageDataGenerator(rescale=1./255)

train_generator = train_datagen.flow_from_directory(
        train_dir,
        target_size=(224, 224),
        batch_size=32,
        class_mode='binary')

validation_generator = val_datagen.flow_from_directory(
        validation_dir,
        target_size=(224, 224),
        batch_size=32,
        class_mode='binary')
Found 2000 images belonging to 2 classes.
Found 1000 images belonging to 2 classes.
In [13]:
history = model.fit(
      train_generator,
      epochs=6,
      validation_data=validation_generator,
      verbose=2)
Train for 63 steps, validate for 32 steps
Epoch 1/6
63/63 - 186s - loss: 0.3764 - accuracy: 0.8310 - val_loss: 0.2603 - val_accuracy: 0.8830
Epoch 2/6
63/63 - 110s - loss: 0.1892 - accuracy: 0.9380 - val_loss: 0.1846 - val_accuracy: 0.9220
Epoch 3/6
63/63 - 81s - loss: 0.1503 - accuracy: 0.9455 - val_loss: 0.1628 - val_accuracy: 0.9360
Epoch 4/6
63/63 - 85s - loss: 0.1325 - accuracy: 0.9480 - val_loss: 0.1793 - val_accuracy: 0.9350
Epoch 5/6
63/63 - 125s - loss: 0.1159 - accuracy: 0.9605 - val_loss: 0.1863 - val_accuracy: 0.9330
Epoch 6/6
63/63 - 101s - loss: 0.1062 - accuracy: 0.9670 - val_loss: 0.1902 - val_accuracy: 0.9320