From 417132a7471df55a6aa3787d295f178dcd4cdf11 Mon Sep 17 00:00:00 2001
From: Carlos Vieira <vieiramecarlos@gmail.com>
Date: Mon, 15 Jun 2020 13:20:39 -0300
Subject: [PATCH] Make no of samples multiple of batch size

---
 transfer-learning.py | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/transfer-learning.py b/transfer-learning.py
index f185273..df54a49 100644
--- a/transfer-learning.py
+++ b/transfer-learning.py
@@ -505,8 +505,11 @@ datagen = ImageDataGenerator(
     vertical_flip=False
 )
 
+val_samples = int(x_train.shape[0] * 0.1)
+# round up to nearest multiple of batch_size
+val_samples += batch_size - (val_samples % batch_size)
 x_train, x_val, y_train, y_val = train_test_split(
-    x_train, y_train, test_size=0.1) 
+    x_train, y_train, test_size=val_samples)
 datagen.fit(x_train)
 
 convs = 1
-- 
GitLab