Reducing the number of filters of a layer in SSD model, using google's Object Detection API

Viewed 322

I am using Google's new Tensorflow Object detection API to train on my own dataset with only one class. Using all the default parameters works ok, so I want to test the perfomance of my model if I reduce the number of filters in some (and possible all) layers. My question is how can I reduce the filters of the layers of the existing ssd_mobile_v1 model?

1 Answers

You can modify the number of filters for all layers by by reducing the depth_multiplier scalar in your config (found under the feature_extractor heading).

Alternatively, you can specify the number of filters in the individual layers which provide feature maps for the localization/classification layer by modifying the feature_map_layout in the relevant feature_extractor module.

For your example you would modify the object_detection.models.ssd_mobilenet_v1_feature_extractor.py module and change the layer_depth. The defaults are shown below.

feature_map_layout = {
    'from_layer': ['Conv2d_11_pointwise', 'Conv2d_13_pointwise', '', '',
                       '', ''],
    'layer_depth': [-1, -1, 512, 256, 256, 128],
    'use_explicit_padding': self._use_explicit_padding,
    'use_depthwise': self._use_depthwise,
}

A preferable alternative would be to create your own feature_extractor module, ensure it is imported in object_detection.builders.model_builder.py and modify the type in your config under the feature_extractor header.

Related