I have a project in python, the goal is to build a model to predict an image of a cat or a dog. My training set has a size of 24977 images, i want to use 10% of that using validation_split in keras. However, when i run this code:
model.fit(x_2, y, epochs = 5, validation_split = 0.1)
this process only took 703 out of 24977, which i don't want to have(it should be 2500 images approximately).
You can see there are 703 images being processed here
The shapes of x_2 and y which i use to feed my model are shown here: for y for x_2
Can anyone explain this error to me and tell me a solution to fix it please? Thank you so much
Here is my codes:
!pip install tensorflow
!pip install keras
import os
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2'
import pickle
import numpy as np
import time
import tensorflow as tf
from tensorflow.keras.callbacks import TensorBoard
from keras.models import Sequential
from keras.layers import Conv2D, MaxPooling2D, Flatten, Dense
x = pickle.load(open('x.pkl','rb'))
y = pickle.load(open('y.pkl','rb'))
x_1 = x/255
x_2 = x_1.astype('float')
model = Sequential()
model.add(Conv2D(64, (3,3), activation = 'relu'))
model.add(MaxPooling2D((2,2)))
model.add(Conv2D(64, (3,3), activation = 'relu'))
model.add(MaxPooling2D((2,2)))
model.add(Flatten())
model.add(Dense(128, input_shape = x.shape[1:], activation = 'relu'))
model.add(Dense(2, activation = 'softmax'))
model.compile(optimizer = 'adam', loss = 'sparse_categorical_crossentropy', metrics = ['accuracy'])
model.fit(x_2, y, epochs = 5, validation_split = 0.1)
I tried to use 10% of my training set data but only got 2% instead and that is not what i want.