Trying to optimize performances on Tensorflow's faster_rcnn_resnet50 (from the model zoo), I'm currently working on understanding the full .config file they provide, and I'm having a hard time with the strides.

Here's the relevant part of the file, with bolded parts being things I'm unsure about:

image_resizer {
  keep_aspect_ratio_resizer {
    min_dimension: 1134
    max_dimension: 2016
feature_extractor {
  type: "faster_rcnn_resnet50"
  first_stage_features_stride: 16
first_stage_anchor_generator {
  grid_anchor_generator {
    height: 28
    width: 31
    height_stride: 14
    width_stride: 15
    scales: 0.242
    scales: 0.621
    scales: 1.0
    scales: 1.739
    scales: 2.478
    aspect_ratios: 0.386
    aspect_ratios: 0.693
    aspect_ratios: 1.0
    aspect_ratios: 1.464
    aspect_ratios: 1.929

What I would like to know is if I should be computing the feature map stride according to the anchors' dimensions and strides or if they're completely unrelated ? Also is there any restriction on the strides themselves, for example keeping them in powers of 2 like the original f-rcnn ?


1 Answer 1


Let me try to explain what exactly stride means generally, then you'll be able to address your specific problem.

Let's say we have an images of size 7x7. Let's take a kernel of size 3x3. When you slide the kernel over image with :

1. stride=1 

2. stride=2

Essentially stride means how much gap you should leave between two kernel position while applying convolution operation.

Now this concept is generic and applies to any operation where we need to slide a kernel over an input.

For Faster-RCNN model, features and anchors are two different things, so probably they're unrelated. Confirm this with official paper though.

For stride size, there is no restriction, you can take it whatever number you want, just make sure it should be less than or equal to half of the size of image(you can think why logically).

  • $\begingroup$ Although there is no restriction, is there a rule of thumb or something for these 2 specific strides or is it purely empirical and based on the dataset used ? $\endgroup$
    – Mat
    Commented Jun 22, 2019 at 21:15
  • $\begingroup$ It's specific to this model. The model input size is fixed in this case, so if you use these parameters you'll get a fixed size feature map, which is what required, irrespective of what dataset you use. $\endgroup$
    – ashukid
    Commented Jun 23, 2019 at 11:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.