My model.loss(prediction_dict, true_shape_tensor) does not work. The error is:

ValueError: Shapes must be equal rank, but are 3 and 1 for ‘{{node Loss/Loss/Select}} = Select[T=DT_FLOAT](Loss/Loss/IsNan, concat_1, Loss/stack_2)’ with input shapes: [0], [4,51150,4], [0].

note that interactive_eager_few_shot_od_training_colab.ipynb works, so I compare tensors which are fed into model.loss. They are exactly same, except of some initial format. For example, shape of working ipynb vs. true_shape_tensor of my problematic code:

working shape: Tensor(“Const:0”, shape=(4, 3), dtype=int32)

my true_shape_tensor: Tensor(“Preprocessor/stack_1:0”, shape=(4, 3), dtype=int32)

The same for preprocessed_inputs;

working code: {‘preprocessed_inputs’: <tf.Tensor ‘concat:0’ shape=(4, 640, 640, 3) dtype=float32>, ‘feature_maps’: [<tf.Tensor ‘ResNet50V1_FPN/FeatureMaps/top_down/smoothing_1/Relu6:0’ shape=(4, 80, 80, 256) dtype=float32>, <tf.Tensor ‘ResNet50V1_FPN/FeatureMaps/top_down/smoothing_2/Relu6:0’ shape=(4, 40, 40, 256) dtype=float32>, <tf.Tensor ‘ResNet50V1_FPN/FeatureMaps/top_down/projection_3/BiasAdd:0’ shape=(4, 20, 20, 256) dtype=float32>, <tf.Tensor ‘ResNet50V1_FPN/bottom_up_block5/Relu6:0’ shape=(4, 10, 10, 256) dtype=float32>, <tf.Tensor ‘ResNet50V1_FPN/bottom_up_block6/Relu6:0’ shape=(4, 5, 5, 256) dtype=float32>], ‘anchors’: <tf.Tensor ‘Concatenate/concat:0’ shape=(51150, 4) dtype=float32>, ‘final_anchors’: <tf.Tensor ‘Tile:0’ shape=(4, 51150, 4) dtype=float32>, ‘box_encodings’: <tf.Tensor ‘concat_1:0’ shape=(4, 51150, 4) dtype=float32>, ‘class_predictions_with_background’: <tf.Tensor ‘concat_2:0’ shape=(4, 51150, 2) dtype=float32>}

my code: {‘preprocessed_inputs’: <tf.Tensor ‘Preprocessor/stack:0’ shape=(4, 640, 640, 3) dtype=float32>, ‘feature_maps’: [<tf.Tensor ‘ResNet50V1_FPN/FeatureMaps/top_down/smoothing_1/Relu6:0’ shape=(4, 80, 80, 256) dtype=float32>, <tf.Tensor ‘ResNet50V1_FPN/FeatureMaps/top_down/smoothing_2/Relu6:0’ shape=(4, 40, 40, 256) dtype=float32>, <tf.Tensor ‘ResNet50V1_FPN/FeatureMaps/top_down/projection_3/BiasAdd:0’ shape=(4, 20, 20, 256) dtype=float32>, <tf.Tensor ‘ResNet50V1_FPN/bottom_up_block5/Relu6:0’ shape=(4, 10, 10, 256) dtype=float32>, <tf.Tensor ‘ResNet50V1_FPN/bottom_up_block6/Relu6:0’ shape=(4, 5, 5, 256) dtype=float32>], ‘anchors’: <tf.Tensor ‘Concatenate/concat:0’ shape=(51150, 4) dtype=float32>, ‘final_anchors’: <tf.Tensor ‘Tile:0’ shape=(4, 51150, 4) dtype=float32>, ‘box_encodings’: <tf.Tensor ‘concat_1:0’ shape=(4, 51150, 4) dtype=float32>, ‘class_predictions_with_background’: <tf.Tensor ‘concat_2:0’ shape=(4, 51150, 2) dtype=float32>}

The only difference is “Const:0” vs. “Preprocessor/stack_1:0” for shapes, and ‘concat:0’ vs. ‘Preprocessor/stack:0’ for preprocessed_inputs. Can anyone comment about potential issue for Preprocessor/stack:0? What to do about it?

Thanks!