Add ONNX model inference implementations for MoGe-2, BEN2, and DA3
- Introduced `onnx_moge2.py` for MoGe-2 ONNX inference with NumPy post-processing. - Added `onnx_ben2.py` for BEN2 ONNX inference with Pillow and NumPy preprocessing. - Created `onnx_da3.py` for Depth Anything 3 inference with ONNX Runtime and NumPy. - Implemented shared ONNX Runtime session helpers in `onnx_runtime.py`. - Developed unit tests for server functionalities in `test_server.py`, including model caching and job management. - Enhanced job server to handle frame extraction without requiring models.
This commit is contained in:
@@ -12,11 +12,11 @@ SOURCE_DIR = (
|
||||
Path(__file__).resolve().parents[1]
|
||||
/ "src"
|
||||
/ "snapform"
|
||||
/ "ai_service"
|
||||
/ "server"
|
||||
)
|
||||
sys.path.insert(0, str(SOURCE_DIR))
|
||||
|
||||
import da3_onnx
|
||||
import onnx_da3
|
||||
|
||||
|
||||
class FakeSession:
|
||||
@@ -37,7 +37,7 @@ class FakeSession:
|
||||
class Da3OnnxTest(unittest.TestCase):
|
||||
def test_target_size_uses_patch_multiple(self):
|
||||
self.assertEqual(
|
||||
da3_onnx.target_size((800, 600), 504, "upper_bound_resize"),
|
||||
onnx_da3.target_size((800, 600), 504, "upper_bound_resize"),
|
||||
(504, 378),
|
||||
)
|
||||
|
||||
@@ -47,7 +47,7 @@ class Da3OnnxTest(unittest.TestCase):
|
||||
Image.new("RGB", (80, 60), (10, 20, 30)).save(image_path)
|
||||
session = FakeSession()
|
||||
|
||||
result = da3_onnx.infer(
|
||||
result = onnx_da3.infer(
|
||||
session,
|
||||
[image_path],
|
||||
process_res=56,
|
||||
|
||||
Reference in New Issue
Block a user