I get this same error with tensorflow2.1 and the reason is that (as it says in the error) that the batch dimension cannot be there.
tf.image.non_max_suppression(
boxes, scores, max_output_size, iou_threshold=0.5,
score_threshold=float('-inf'), name=None )
boxes A 2-D float Tensor of shape [num_boxes, 4].
Example:
selected_indices = tf.image.non_max_suppression(
boxes=boxes,
scores=scores,
max_output_size=7,
iou_threshold=0.5)
You should remove the first(batch) dimension of the tensors (boxes and scores in the example above)
In case your batch dimension is 1 you can use
boxes = tf.squeeze(boxes)
scores = tf.squeeze(scores)
It seems that you can have batch dimension is in this beast:
https://www.tensorflow.org/api_docs/python/tf/image/combined_non_max_suppression