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": "."}
|