'Changing input dimension of Model zoo's Mobilenet-SSD V2

I have used the pretrained ssd_mobilenet_v2_fpnlite_320x320_coco17_tpu-8 for real time object detection. The default input dimension is 320 x 320 for the model. I want to experiment on changing it to 100x100 or 200x200 but when I change the config file it results to an error. How can I fix this?

This is the Edit to the config file apart from the paths.

model {
  ssd {
    num_classes: 36
    image_resizer {
      fixed_shape_resizer {
        height: 100
        width: 100
      }
    }

The Error

 ValueError: Dimensions must be equal, but are 8 and 7 for '{{node ssd_mobile_net_v2_fpn_keras_feature_extractor/FeatureMaps/top_down/add}} = AddV2[T=DT_FLOAT](ssd_mobile_net_v2_fpn_keras_feature_extractor/FeatureMaps/top_down/nearest_neighbor_upsampling/nearest_neighbor_upsampling/Reshape_1, ssd_mobile_net_v2_fpn_keras_feature_extractor/FeatureMaps/top_down/projection_2/BiasAdd)' with input shapes: [4,8,8,128], [4,7,7,128].


        Call arguments received:
          • image_features=[("'layer_7'", 'tf.Tensor(shape=(4, 13, 13, 32), dtype=float32)'), ("'layer_14'", 'tf.Tensor(shape=(4, 7, 7, 96), dtype=float32)'), ("'layer_19'", 'tf.Tensor(shape=(4, 4, 4, 1280), dtype=float32)')]


    Call arguments received:
      • inputs=tf.Tensor(shape=(4, 100, 100, 3), dtype=float32)
      • kwargs={'training': 'False'}


Solution 1:[1]

At the pipeline config when you using Tensorflow Object Detection API:

model {
  ssd {
    num_classes: 1 
    image_resizer {
      fixed_shape_resizer {
        height: your desired height
        width: your desired width
      }
    }

Solution 2:[2]

The error indicates, that your input dimension is not compatible with the model architecture.

So Try other input dimensions, such as 128, 256, and every other dimension that is divisible by 32.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 dtlam26
Solution 2 Kaveh