feat: Implement ONNX model inference for BEN2, Depth Anything 3, and MoGe
- Added `ben2_onnx.py` for BEN2 ONNX inference with preprocessing. - Introduced `da3_onnx.py` for Depth Anything 3 inference, including camera projection calculations. - Created `moge_onnx.py` for MoGe-2 ONNX inference and post-processing. - Implemented shared ONNX Runtime session helpers in `onnx_runtime.py`. - Added model synchronization script `sync_models.py` for downloading and verifying ONNX models. - Developed unit tests for BEN2, Depth Anything 3, and MoGe ONNX models to ensure functionality. - Updated `vendor.lock.toml` to remove unused artifacts.
This commit is contained in:
@@ -280,6 +280,10 @@ class AddonTest(unittest.TestCase):
|
||||
annotations["snapform_process_res_factor"]["subtype"],
|
||||
"PERCENTAGE",
|
||||
)
|
||||
self.assertEqual(
|
||||
annotations["snapform_model"]["default"],
|
||||
0,
|
||||
)
|
||||
|
||||
def test_image_mesh_uses_o_prefixed_attributes_and_bundled_nodes(self):
|
||||
image_mesh = self.addon.image_mesh
|
||||
@@ -644,8 +648,11 @@ class AddonTest(unittest.TestCase):
|
||||
def test_conversion_dialog_exposes_requested_settings(self):
|
||||
operator = self.addon.ConvertImageToDepthPlane
|
||||
|
||||
self.assertEqual(operator.__annotations__["snapform_model"]["default"], 1)
|
||||
self.assertTrue(operator.__annotations__["snapform_use_ray_pose"]["default"])
|
||||
self.assertEqual(
|
||||
operator.__annotations__["snapform_model"]["default"],
|
||||
0,
|
||||
)
|
||||
self.assertFalse(operator.__annotations__["snapform_use_ray_pose"]["default"])
|
||||
self.assertEqual(
|
||||
operator.__annotations__["snapform_process_res_factor"]["default"],
|
||||
100.0,
|
||||
@@ -1094,7 +1101,6 @@ class AddonTest(unittest.TestCase):
|
||||
for snapform_model, snapform_ray_pose in (
|
||||
("SMALL", True),
|
||||
("BASE", False),
|
||||
("LARGE_1_1", True),
|
||||
("GIANT_1_1", False),
|
||||
("NESTED_GIANT_LARGE_1_1", True),
|
||||
):
|
||||
@@ -1947,8 +1953,8 @@ class AddonTest(unittest.TestCase):
|
||||
self.addon.DebugPanel.bl_options,
|
||||
)
|
||||
panels = (
|
||||
self.addon.Da3OutputDebugPanel,
|
||||
self.addon.Moge2ApiDebugPanel,
|
||||
self.addon.Da3OutputDebugPanel,
|
||||
self.addon.Ben2RemovalDebugPanel,
|
||||
)
|
||||
for panel in panels:
|
||||
@@ -1956,7 +1962,7 @@ class AddonTest(unittest.TestCase):
|
||||
self.assertIn("DEFAULT_CLOSED", panel.bl_options)
|
||||
self.assertEqual(
|
||||
[panel.bl_label for panel in panels],
|
||||
["DA3", "MoGe-2", "BEN2"],
|
||||
["MoGe-2", "DA3", "BEN2"],
|
||||
)
|
||||
|
||||
def test_service_panel_exposes_shared_service_state_and_controls(self):
|
||||
@@ -2483,7 +2489,7 @@ class AddonTest(unittest.TestCase):
|
||||
for index, value in enumerate(command)
|
||||
if value == "--allow-pattern"
|
||||
]
|
||||
self.assertEqual(patterns, ["config.json", "model.safetensors"])
|
||||
self.assertEqual(patterns, ["onnx/model_fp16.onnx"])
|
||||
label_index = command.index("--label")
|
||||
self.assertEqual(command[label_index + 1], "BEN2 Base")
|
||||
|
||||
@@ -2512,15 +2518,12 @@ class AddonTest(unittest.TestCase):
|
||||
self.assertEqual(command[0], sys.executable)
|
||||
self.assertIn("--uv", command)
|
||||
self.assertIn("C:/uv/uv.exe", command)
|
||||
self.assertEqual(
|
||||
command[command.index("--torch-variant") + 1],
|
||||
"cu128",
|
||||
)
|
||||
self.assertNotIn("--torch-variant", command)
|
||||
self.assertTrue(
|
||||
any("install_env.py" in str(value) for value in command)
|
||||
)
|
||||
|
||||
def test_install_env_command_auto_selects_torch_variant(self):
|
||||
def test_install_env_command_does_not_select_legacy_runtime(self):
|
||||
client = importlib.import_module("snapform.client")
|
||||
with patch.object(
|
||||
client,
|
||||
@@ -2542,10 +2545,7 @@ class AddonTest(unittest.TestCase):
|
||||
command = client.install_env_command(Path("status.json"))
|
||||
|
||||
self.assertNotIn("--pypi-index", command)
|
||||
self.assertEqual(
|
||||
command[command.index("--torch-variant") + 1],
|
||||
"cpu",
|
||||
)
|
||||
self.assertNotIn("--torch-variant", command)
|
||||
self.assertIn("C:/uv/uv.exe", command)
|
||||
|
||||
def test_completed_export_opens_job_directory(self):
|
||||
|
||||
Reference in New Issue
Block a user