matterport / Mask_RCNN

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

Improper mask creation in custom satellite image. #1222

Open rabelhmd opened 5 years ago

rabelhmd commented 5 years ago

Hello everyone, We are trying to implement Mask RCNN on a different data set. Here, as you can all see, I have provided an image of a satellite taken a picture and the output after passing it through mask RCNN is horrible, it can not detect any kind of object rather it is detecting a portion of the image as a road. What should I possibly do to make it correct or is there any known limitation on this sector of Mask RCNN. Kindly let me know. Thanks in advance. image

I have used this Configurations: BACKBONE resnet101 BACKBONE_STRIDES [4, 8, 16, 32, 64] BATCH_SIZE 3 BBOX_STD_DEV [0.1 0.1 0.2 0.2] COMPUTE_BACKBONE_SHAPE None DETECTION_MAX_INSTANCES 100 DETECTION_MIN_CONFIDENCE 0.7 DETECTION_NMS_THRESHOLD 0.3 FPN_CLASSIF_FC_LAYERS_SIZE 1024 GPU_COUNT 1 GRADIENT_CLIP_NORM 5.0 IMAGES_PER_GPU 3 IMAGE_MAX_DIM 320 IMAGE_META_SIZE 14 IMAGE_MIN_DIM 320 IMAGE_MIN_SCALE 0 IMAGE_RESIZE_MODE square IMAGE_SHAPE [320 320 3] LEARNING_MOMENTUM 0.9 LEARNING_RATE 0.001 LOSS_WEIGHTS {'rpn_class_loss': 1.0, 'rpn_bbox_loss': 1.0, 'mrcnn_class_loss': 1.0, 'mrcnn_bbox_loss': 1.0, 'mrcnn_mask_loss': 1.0} MASK_POOL_SIZE 14 MASK_SHAPE [28, 28] MAX_GT_INSTANCES 100 MEAN_PIXEL [123.7 116.8 103.9] MINI_MASK_SHAPE (56, 56) NAME road NUM_CLASSES 2 POOL_SIZE 7 POST_NMS_ROIS_INFERENCE 1000 POST_NMS_ROIS_TRAINING 2000 ROI_POSITIVE_RATIO 0.33 RPN_ANCHOR_RATIOS [0.5, 1, 2] RPN_ANCHOR_SCALES (32, 64, 128, 256, 512) RPN_ANCHOR_STRIDE 1 RPN_BBOX_STD_DEV [0.1 0.1 0.2 0.2] RPN_NMS_THRESHOLD 0.7 RPN_TRAIN_ANCHORS_PER_IMAGE 256 STEPS_PER_EPOCH 10 TOP_DOWN_PYRAMID_SIZE 256 TRAIN_BN False TRAIN_ROIS_PER_IMAGE 200 USE_MINI_MASK True USE_RPN_ROIS True VALIDATION_STEPS 1 WEIGHT_DECAY 0.0001

stygian2a commented 5 years ago

Did you train it? Can we see some training/validation curves?

rabelhmd commented 5 years ago

@stygian2a Yes, I have trained it for 10 epoch, keeping 200 original images along with corresponding masks. Here are the training and validation logs whilst training.
training_mask

stygian2a commented 5 years ago

You should let it train longer, the validation loss is still quickly descending. Does it always detects a portion of the image as a road? Are you sure that you load up the last weights before infering?

rabelhmd commented 5 years ago

@stygian2a Yes, it always detects a portion of the image a road. I am quite sure that I am loading last saved weights before predicting.

windson87 commented 5 years ago

@rabelhmd same suffering here. but do you think this should be changed too? MEAN_PIXEL = [123.7, 116.8, 103.9] since I guess this default setting is for coco-dataset? This used to format the input image before fit into the model

May-forever commented 5 years ago

Dear rabelhmd,

I want to use Mask-RCNN to train on my custom dataset (just one class).

First of all, I use Labelme to create groundtruth for each image. Each image has a .json file as its ground-truth.

After that, I don't know what should I do...

I want to know how to convert my groundtruth file to a format that Mask-rcnn can use. Do you have any tools ?

Looking forward to hearing from you, thanks in advance.

With best regards, Ming

josephofiowa commented 5 years ago

@rabelhmd With 200 images, you should consider geometric transformations (resizing, random crop, rotation and horizontal flipping, aspect ratio) and intensity transformations (contrast and brightness enhancement, color, noise) increase the variation of images in your training dataset. Random rotations may also help.

As stygian2a pointed out, your loss is still dropping rapidly at 10 epochs, so training for longer will also help. Consider reducing the size of your images for faster training.

Email me if you want help implementing the above transformations: joseph@roboflow.ai