training convnet from scratch on small dataset dense_ (dense(none ===============================================================total params , , trainable params , , non-trainable params for the compilation stepyou'll go with the rmsprop optimizeras usual because you ended the network with single sigmoid unityou'll use binary crossentropy as the loss (as remindercheck out table for cheatsheet on what loss function to use in various situationslisting configuring the model for raining from keras import optimizers model compile(loss='binary_crossentropy'optimizer=optimizers rmsprop(lr= - )metrics=['acc']data preprocessing as you know by nowdata should be formatted into appropriately preprocessed floatingpoint tensors before being fed into the network currentlythe data sits on drive as jpeg filesso the steps for getting it into the network are roughly as follows read the picture files decode the jpeg content to rgb grids of pixels convert these into floating-point tensors rescale the pixel values (between and to the [ interval (as you knowneural networks prefer to deal with small input valuesit may seem bit dauntingbut fortunately keras has utilities to take care of these steps automatically keras has module with image-processing helper toolslocated at keras preprocessing image in particularit contains the class imagedatageneratorwhich lets you quickly set up python generators that can automatically turn image files on disk into batches of preprocessed tensors this is what you'll use here listing using imagedatagenerator read images from direct ories from keras preprocessing image import imagedatagenerator train_datagen imagedatagenerator(rescale= / test_datagen imagedatagenerator(rescale= / rescales all images by / train_generator train_datagen flow_from_directorytrain_dirtarget_size=( resizes all images to target batch_size= directory class_mode='binary'validation_generator test_datagen flow_from_directoryvalidation_dirlicensed to because you use binary_crossentropy lossyou need binary labels