DenseNet backbone batch normalization

Hi,

I would like to change the backbone of Mask R-NN from Resnet to DenseNet. I have followed the tutorial but I am not sure if I should freeze batch normalization. I am not using fpn.

Please help!

backbone= torchvision.models.densenet121(pretrained= True).features
backbone.out_channels =1024

for name, param in backbone.named_parameters():
    if 'norm' in name:
        param.requires_grad = False

anchor_generator = AnchorGenerator(sizes=((8, 16, 32, 128, 256),),
                           aspect_ratios=((0.25, 0.5, 1.0, 2.0),))

roi_pooler = torchvision.ops.MultiScaleRoIAlign(featmap_names=['0'],
                                                output_size=7,
                                                sampling_ratio=2)

mask_pooler = torchvision.ops.MultiScaleRoIAlign(featmap_names=['0'],
                                                output_size=14,
                                                sampling_ratio=2)


model = MaskRCNN(backbone, num_classes, rpn_anchor_generator=anchor_generator, 
                 box_roi_pool=roi_pooler, mask_roi_pool = mask_pooler)