- Implemented surface generation functionality in `surface.py`, including geometry estimation and texture writing. - Introduced media input handling in `input.py`, supporting image and video frame extraction. - Added model management for geometry adapters in `models/__init__.py`. - Created BEN2 and DA3 model inference logic in `ben2.py` and `da3.py`, respectively. - Developed ONNX model inference utilities for BEN2 and DA3 in `onnx_ben2.py` and `onnx_da3.py`. - Added support for MoGe-2 model inference in `moge2.py` with necessary ONNX utilities. - Implemented output handling for depth and surface data in `depth.py` and `surface.py`. - Created debug output utilities for DA3 and MoGe-2 predictions in `debug_da3.py` and `debug_moge2.py`. - Enhanced ONNX runtime session management in `onnx_runtime.py`. - Updated `__init__.py` files to include new modules and functions for better organization.
22 lines
759 B
Python
22 lines
759 B
Python
from ..media import copy_frames
|
|
from ..models import da3
|
|
from ..outputs.debug_da3 import write_prediction
|
|
from .common import input_frames
|
|
|
|
|
|
def run(context, parameters):
|
|
context.progress(0.02, "Preparing DA3 API input")
|
|
context.directory.mkdir(parents=True, exist_ok=True)
|
|
with input_frames(context, parameters) as images:
|
|
prediction = da3.infer(
|
|
context.resource("model_manager"),
|
|
parameters,
|
|
images,
|
|
cancel_check=context.check_cancelled,
|
|
)
|
|
write_prediction(prediction, context.directory / "prediction.npz")
|
|
copy_frames(images, context.directory)
|
|
context.check_cancelled()
|
|
context.progress(1.0, "Saved raw DA3 API prediction")
|
|
return {"directory": "."}
|