Add new tests and functionality for image processing and geometry handling

- Introduced color_image.py for preparing standalone color images for tests.
- Added hdr_image.py to create HDR textures for testing.
- Implemented test_image_depth_panorama.py to evaluate panorama topology, UVs, and depth discontinuities.
- Created test_shadeless.py to validate the opacity and HDR color endpoints of the Shadeless group.
- Developed moge3_export.py for exporting dynamic MoGe-3 backbone and ONNX graphs.
- Added material.py to inherit material slots onto generated geometry.
- Built image_depth_panorama.py to construct a quad panorama with depth separation and sampling.
This commit is contained in:
2026-09-10 14:42:17 +08:00
parent 27ca25224a
commit 489003c2cc
136 changed files with 5758 additions and 1083 deletions

View File

@@ -36,13 +36,13 @@ class Ben2OnnxTest(unittest.TestCase):
names, feeds
),
) as run:
result = onnx_ben2.infer(
result = onnx_ben2.infer_alpha(
session,
Image.new("RGB", (40, 20)),
release_memory=False,
)
self.assertEqual(result.size, (40, 20))
self.assertEqual(result.shape, (20, 40))
self.assertFalse(run.call_args.kwargs["release_memory"])
def test_preprocess_matches_model_layout(self):
@@ -57,13 +57,18 @@ class Ben2OnnxTest(unittest.TestCase):
session = FakeSession()
image = Image.new("RGB", (40, 20), (10, 20, 30))
result = onnx_ben2.infer(session, image)
result = onnx_ben2.infer_alpha(session, image)
self.assertEqual(result.mode, "RGBA")
self.assertEqual(result.size, image.size)
self.assertEqual(result.dtype, np.float32)
self.assertEqual(result.shape, (20, 40))
self.assertEqual(session.feeds["input"].shape, (1, 3, 1024, 1024))
alpha = np.asarray(result.getchannel("A"))
self.assertLess(int(alpha[:, 0].max()), int(alpha[:, -1].min()))
self.assertLess(result[:, 0].max(), result[:, -1].min())
self.assertTrue(np.any(np.abs(result * 255 - np.rint(result * 255)) > 0.01))
def test_infer_rejects_nonfinite_mask(self):
with patch.object(onnx_ben2, "run_session", return_value=[np.full((1, 1, 2, 2), np.nan)]):
with self.assertRaisesRegex(RuntimeError, "invalid alpha"):
onnx_ben2.infer_alpha(FakeSession(), Image.new("RGB", (2, 2)))
if __name__ == "__main__":