MCPcopy Create free account
hub / github.com/apple/axlearn / test_encode_and_decode_boxes

Method test_encode_and_decode_boxes

axlearn/vision/box_coder_test.py:20–29  ·  view source on GitHub ↗
(self, weights)

Source from the content-addressed store, hash-verified

18 {"testcase_name": "faster_rcnn_weights", "weights": (10.0, 10.0, 5.0, 5.0)},
19 )
20 def test_encode_and_decode_boxes(self, weights):
21 coder_cfg = box_coder.BoxCoder.default_config()
22 if weights:
23 coder_cfg = coder_cfg.set(weights=weights)
24 coder = coder_cfg.instantiate()
25 boxes = jnp.asarray([[10.0, 25.0, 20.0, 25.0], [20.0, 40.0, 30.0, 50.0]])
26 anchors = jnp.asarray([[12.0, 23.0, 22.0, 27.0], [22.0, 38.0, 33.0, 47.0]])
27 encoded_boxes = coder.encode(boxes=boxes, anchors=anchors)
28 decoded_boxes = coder.decode(encoded_boxes=encoded_boxes, anchors=anchors)
29 np.testing.assert_allclose(boxes, decoded_boxes)
30
31 def test_encoded_zero_area_boxes_are_finite(self):
32 boxes = jnp.asarray(

Callers

nothing calls this directly

Calls 5

default_configMethod · 0.45
setMethod · 0.45
instantiateMethod · 0.45
encodeMethod · 0.45
decodeMethod · 0.45

Tested by

no test coverage detected