Add model catalog with specifications for DA3 and MoGe-2 models

- Introduced ModelSpec dataclass to define model attributes.
- Added multiple models including DA3 Small, Base, Giant 1.1, Nested Giant Large 1.1, and MoGe-2 variants.
- Implemented functions to retrieve model details and metadata.
- Included BEN2 model specifications for background removal.
This commit is contained in:
2026-08-17 14:53:25 +08:00
parent c5b77c5c85
commit 1c98b21235
44 changed files with 637 additions and 2709 deletions

View File

@@ -7,6 +7,7 @@ from .job_runtime import JobOperatorBase, runtime
from .properties import (
BEN2_MODEL_KEY,
DEFAULT_MOGE2_MODEL_KEY,
REQUIRED_MODEL_KEYS,
model_ready,
model_record,
)
@@ -296,7 +297,7 @@ def apply_background_response(result, source_object_name):
push_undo("Remove Background")
def da3_parameters(settings, path, model, process_res, use_ray_pose, start_frame):
def da3_parameters(settings, path, model, process_res, start_frame):
return {
"input": str(path),
"model": model,
@@ -310,7 +311,6 @@ def da3_parameters(settings, path, model, process_res, use_ray_pose, start_frame
"start_frame": start_frame,
"device": production_device().lower(),
"ref_view_strategy": settings.ref_view_strategy,
"use_ray_pose": 1 if use_ray_pose else 0,
}
@@ -342,6 +342,19 @@ class DownloadModel(JobOperatorBase, bpy.types.Operator):
return {"model": self.model}
class DownloadRequiredModels(JobOperatorBase, bpy.types.Operator):
bl_idname = "snapform.download_required_models"
bl_label = "Download Required Models"
job_type = "download-required-models"
starting_message = "Starting required model downloads"
def request(self, _context):
require_environment()
if not bpy.app.online_access:
raise RuntimeError("Online Access is disabled in Blender Preferences")
return {"models": list(REQUIRED_MODEL_KEYS)}
class DebugDa3(JobOperatorBase, bpy.types.Operator):
bl_idname = "snapform.debug_da3"
bl_label = "Debug DA3"
@@ -362,7 +375,6 @@ class DebugDa3(JobOperatorBase, bpy.types.Operator):
input_path(settings.input_path),
model,
settings.process_res,
settings.use_ray_pose,
1,
),
"device": settings.device.lower(),
@@ -439,7 +451,6 @@ class GenerateDa3Depth(JobOperatorBase, bpy.types.Operator):
source_object_name: bpy.props.StringProperty(options=HIDDEN)
depth_data_name: bpy.props.StringProperty(options=HIDDEN)
model: bpy.props.StringProperty(default="BASE", options=HIDDEN)
use_ray_pose: bpy.props.BoolProperty(default=False, options=HIDDEN)
process_res: bpy.props.IntProperty(default=1024, min=1, options=HIDDEN)
delete_source: bpy.props.BoolProperty(default=True, options=HIDDEN)
delete_input: bpy.props.BoolProperty(default=False, options=HIDDEN)
@@ -458,7 +469,6 @@ class GenerateDa3Depth(JobOperatorBase, bpy.types.Operator):
input_path(self.input_path),
self.model,
self.process_res,
self.use_ray_pose,
source_start_frame(self.source_object_name),
),
"export_format": "mini_npz",
@@ -542,7 +552,6 @@ class GenerateDa3Surface(JobOperatorBase, bpy.types.Operator):
input_path: bpy.props.StringProperty(options=HIDDEN)
source_object_name: bpy.props.StringProperty(options=HIDDEN)
model: bpy.props.StringProperty(default="BASE", options=HIDDEN)
use_ray_pose: bpy.props.BoolProperty(default=False, options=HIDDEN)
process_res: bpy.props.IntProperty(default=1024, min=1, options=HIDDEN)
delete_source: bpy.props.BoolProperty(default=True, options=HIDDEN)
delete_input: bpy.props.BoolProperty(default=False, options=HIDDEN)
@@ -562,7 +571,6 @@ class GenerateDa3Surface(JobOperatorBase, bpy.types.Operator):
input_path(self.input_path),
self.model,
self.process_res,
self.use_ray_pose,
source_start_frame(self.source_object_name),
),
"export_format": "mesh_data",
@@ -762,6 +770,7 @@ class ClearModels(bpy.types.Operator):
JOB_OPERATOR_CLASSES = (
DownloadModel,
DownloadRequiredModels,
DebugDa3,
DebugMoge2,
DebugBen2,