Practical-Deep-Learning-Book icon indicating copy to clipboard operation
Practical-Deep-Learning-Book copied to clipboard

chapter-4/1_feature_extraction.ipynb using default batch size 32 instead of defined batch_size 128

Open gitgithan opened this issue 2 years ago • 1 comments

batch_size = 128
datagen = tensorflow.keras.preprocessing.image.ImageDataGenerator(preprocessing_function=preprocess_input)

generator = datagen.flow_from_directory(root_dir,
                                        target_size=(224, 224),
                                        class_mode=None,
                                        shuffle=False)

uses default batch_size = 32.

num_epochs = int(math.ceil(num_images / batch_size)) calculates 68 epochs based on 128 batch size. So generator only generates 68*32 = 2176 images for feature_list, mismatching the 8677 in standard_feature_list with features extracted from the non generator method.

gitgithan avatar Feb 10 '23 15:02 gitgithan

@PracticalDL This seems like a pretty big issue. The whole of chapter 4 uses the wrong number of training samples.

havardox avatar Aug 21 '23 10:08 havardox