Keras 3 API 文档 / KerasCV / 边界框格式和工具 / 边界框工具 / 确保您的边界框符合边界框规范

确保您的边界框符合边界框规范

[source]

validate_format function

keras_cv.bounding_box.validate_format(bounding_boxes, variable_name="bounding_boxes")

validates that a given set of bounding boxes complies with KerasCV format.

For a set of bounding boxes to be valid it must satisfy the following conditions: - bounding_boxes must be a dictionary - contains keys "boxes" and "classes" - each entry must have matching first two dimensions; representing the batch axis and the number of boxes per image axis. - either both "boxes" and "classes" are batched, or both are unbatched.

Additionally, one of the following must be satisfied: - "boxes" and "classes" are both Ragged - "boxes" and "classes" are both Dense - "boxes" and "classes" are unbatched

Arguments

  • bounding_boxes: dictionary of bounding boxes according to KerasCV format.

Raises

ValueError if any of the above conditions are not met