MCPcopy Index your code
hub / github.com/PDFMathTranslate/PDFMathTranslate / test_scale_boxes

Method test_scale_boxes

test/test_doclayout.py:46–55  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

44 self.assertGreater(padded_width, 0)
45
46 def test_scale_boxes(self):
47 img1_shape = (1024, 1024) # Model input shape
48 img0_shape = (500, 300) # Original image shape
49 boxes = np.array([[512, 512, 768, 768]]) # Example bounding box
50
51 scaled_boxes = self.model.scale_boxes(img1_shape, boxes, img0_shape)
52
53 # Verify the output is scaled correctly
54 self.assertEqual(scaled_boxes.shape, boxes.shape)
55 self.assertTrue(np.all(scaled_boxes <= max(img0_shape)))
56
57 def test_predict(self):
58 # Mock model inference output

Callers

nothing calls this directly

Calls 2

scale_boxesMethod · 0.80
allMethod · 0.80

Tested by

no test coverage detected