Data Science Asked by Bio on February 15, 2021
I have built a CNN for regression, but it is giving identical predictions (up to 8 sig. fig.) for almost 1/3 of the test data set. (The other outputs are different.) Is there a reason why this might be happening? Could this be a sign of over-fitting? I find this strange, as the nature of the prediction should be continuous. The input images are generated using another program, but I’m suspecting that the problem is broader than just a few problematic images.
Below is the code for the model (I’m using Keras).
model = Sequential([
Conv2D(16, (7,7), activation='relu', input_shape=(1024,1024,1)),
BatchNormalization(),
MaxPooling2D((3,3), strides=(2,2)),
Conv2D(32, (5,5), activation='relu'),
BatchNormalization(),
MaxPooling2D((3,3), strides=(2,2)),
Conv2D(64, (3,3), activation='relu'),
BatchNormalization(),
MaxPooling2D((3,3), strides=(2,2)),
Conv2D(128, (3,3), activation='relu'),
BatchNormalization(),
MaxPooling2D((2,2), strides=(2,2)),
Conv2D(256, (3,3), activation='relu'),
BatchNormalization(),
MaxPooling2D((2,2), strides=(2,2)),
Flatten(),
Dense(128, activation='relu'),
Dropout(0.5),
Dense(128, activation='relu'),
Dropout(0.5),
Dense(128, activation='relu'),
Dropout(0.5),
Dense(1, activation='linear')
])
For training, I’m doing something like this
for i in range(6):
model.fit_generator(train_batches, steps_per_epoch=TRAIN_STEP, validation_data=valid_batches, validation_steps=VALID_STEP, epochs=5, verbose=2)
# some functions here to check up on the model
model.save('model_epoch' + str((i+1)*5) + '.h5')
I have 267 images for training, 46 for validation, and 35 for testing. train_batch
contains the training images in batches, with image augmentation of horizontal_flip=True
and vertical_flip=True
. I’m using a batch size of 4 for all 3 sets of images. The steps value is calculated by dividing the number of images by the batch size (4 in this case)
Please let me know if I’m doing anything wrong. Thanks!
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP