keras-cv
keras-cv copied to clipboard
pad_batch_to_shape does not work with ragged bounding boxes
Repro code:
a = tf.ragged.constant([[[1,2,3,4,50], [1,2,3,5,32]],
[[0,2,3,6,66], [0,2,3,7,48], [0,2,3,8,47]]], ragged_rank=1)
print(tf.shape(a))
kcv.bounding_box.pad_batch_to_shape(a, target_shape=[2, 3, 5])
output:
/opt/conda/lib/python3.7/site-packages/keras_cv/bounding_box/pad_batch_to_shape.py in pad_batch_to_shape(bounding_boxes, target_shape, padding_values)
46 """
47 bounding_box_shape = tf.shape(bounding_boxes)
---> 48 if len(bounding_box_shape) != len(target_shape):
49 raise ValueError(
50 "Target shape should have same rank as the bounding box. "
TypeError: object of type 'DynamicRaggedShape' has no len()
Expected output:
[[[1,2,3,4,50], [1,2,3,5,32], [-1,-1,-1,-1,-1]],
[[0,2,3,6,66], [0,2,3,7,48], [0,2,3,8,47]]]
Unit tests for ragged bounding boxes seem to be lacking as well.
adding the "object-detection-landing" flag because this utility functions is needed for the TPU-compatible object detection pipeline