matterport / Mask_RCNN

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

Feature request: Group Normalization for Mask_RCNN #402

Open mpsampat opened 6 years ago

mpsampat commented 6 years ago

Hi @waleedka ,

This was one of the posts today in the competition (copied below). it is about a new normalization technique called Group Normalization. The paper reports that it helps to speed up Mask RCNN training. One implementation of Group Normalization is also listed in the github link below. Would you have time to add this feature to the repo ? Thanks Mehul

Copy pasted from discussion: https://www.kaggle.com/c/data-science-bowl-2018/discussion/53833

"There's a useful new normalization technique called Group Norm (GN) that has many of the same benefits as Batch Norm (BN), but works well for small batch sizes. Of particular relevance, the authors try GN on Mask R-CNN and claim an increase of 1.4 in bounding box AP on COCO after replacing frozen BN layers in the ResNet backbone with GN and adding GN to the feature pyramid network.

https://arxiv.org/pdf/1803.08494.pdf

For anyone using the Matterport code (or any keras model), there are already a couple of implementations on github that can be easily added to your model.

https://github.com/titu1994/Keras-Group-Normalization

https://github.com/shaoanlu/GroupNormalization-keras

I don't know how it will affect LB results yet, but it does make training noticeably faster and allows you to use larger learning rates with Matterport code (e.g. 1e-2)."

hellojialee commented 6 years ago

@mpsampat An error occur when the group normalization layer is used: TypeError: Failed to convert object of type <class 'list'> to Tensor. Contents: [-1, 32, None, None, 2]. Consider casting elements to a supported type. Do you meet with this issue. It seems that the K.reshape cannot work well.

hellojialee commented 6 years ago

It seems that the input shape must be given. In other words, (None, None, 3) will raise error above.

engineer1109 commented 6 years ago

@mpsampat Do you know how to replace BM with GM?

travishsu commented 5 years ago

I tried install keras-contrib and replace BatchNorm by

from keras_contrib.layers import GroupNormalization
class BatchNorm(GroupNormalization):
    def call(self, inputs, training=None):
        return super(self.__class__, self).call(inputs, training=training)

now I can use ResNet101-MRCNN with GN from scratch.

I think it'll much better if there is the GN pretrained model trained using Imagenet.

fandipres commented 2 years ago

Any update how to replace BN with GN with this code?