matterport / Mask_RCNN

Mask R-CNN for object detection and instance segmentation on Keras and TensorFlow
Other
24.65k stars 11.7k forks source link

Overfitting altough using Augmentation #2083

Open WhyWouldYouTilt opened 4 years ago

WhyWouldYouTilt commented 4 years ago

Hey Guys, im training the Mask R-CNN Model on my own Dataset consisting of 440 Train images and 60 Validation images. The Goal is to detect structurally Damaged Areas of Bridges, Railings and so on. For That im using 4 classes. Eventough im using this code of Augmentation:

max_augs = 3 augmentation = imgaug.augmenters.SomeOf((0, max_augs), [ imgaug.augmenters.Fliplr(0.5), imgaug.augmenters.Flipud(0.5), imgaug.augmenters.OneOf([imgaug.augmenters.Affine(rotate=30 * i) for i in range(0, 12)]), imgaug.augmenters.Affine(scale={"x": (0.8, 1.2), "y": (0.8, 1.2)}), imgaug.augmenters.Add((-40, 40)), imgaug.augmenters.Multiply((0.8, 1.5)), imgaug.augmenters.GaussianBlur(sigma=(0.0, 5.0)) ]) it doesnt train really well... Im training on a ResNet101 which is pretrained on the ImageNet Dataset When i plot the loss and the val Loss i get these results:

Loss Plot

This is the code in my main class: `class BridgesConfig(Config): NAME="bridges"

Because of weaker GPU:

IMAGES_PER_GPU = 2

# Number of classes (including background):
NUM_CLASSES = 1 + 4  # Background + TK + B_fehlend + B_korrodiert + B_Blasen

# Number of training steps per epoch
STEPS_PER_EPOCH = 520
VALIDATION_STEPS = 62

BACKBONE = "resnet101"

RPN_ANCHOR_SCALES = (32, 64, 128, 256, 512)

USE_MINI_MASK = True
# Skip detections with <70% confidence
DETECTION_MIN_CONFIDENCE = 0

GPU_COUNT = 1`
NeyoxDrago commented 4 years ago

hey there , i didn't know much about it . But i think you are augmenting it very much,and also applying a hell lot of augmenting measures . Try a model with a bit less augmenting parameters , and if possible also try to reduce the batch_size of augmentation and it can sometimes lead to overfitting.

basirsedighi commented 4 years ago

Hi tell me how it went, i am not sure with your dataset as i havent seen it but i have a theroy, can you please try again but without the Gaussianblur

gebawe commented 9 months ago

@WhyWouldYouTilt interesting issue, I have faced a similar problem and investigating if that is related to imgaug. Can you please share your findings? Have you solved the overfitting problem?