我使用预训练的ssd_mobilenet_v2_fpnlite_320x320_coco17_tpu-8进行实时对象检测。模型的默认输入尺寸是320 x 320。我想尝试将其更改为100x100或200x200,但当我更改配置文件时,它会导致错误。我该如何解决这个问题?
这是对配置文件的编辑,除了路径。
model {
ssd {
num_classes: 36
image_resizer {
fixed_shape_resizer {
height: 100
width: 100
}
}
误差
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'}
在使用Tensorflow对象检测API时的管道配置:
model {
ssd {
num_classes: 1
image_resizer {
fixed_shape_resizer {
height: your desired height
width: your desired width
}
}
错误指示,您的输入维度与模型体系结构不兼容。
那么试试其他的输入维度,比如128、256,以及所有能被32整除的维度。