mirror of
https://github.com/SikongJueluo/Mini-Nav.git
synced 2026-07-12 20:15:31 +08:00
refactor(pipeline): integrate SAM segmentation and modularize model loading
This commit is contained in:
@@ -1,10 +1,11 @@
|
||||
model:
|
||||
name: "facebook/dinov2-large"
|
||||
dino_model: "facebook/dinov2-large"
|
||||
compression_dim: 512
|
||||
device: "auto" # auto-detect GPU
|
||||
sam_model: "facebook/sam2.1-hiera-large" # SAM model name
|
||||
sam_min_mask_area: 100 # Minimum mask area threshold
|
||||
sam_max_masks: 10 # Maximum number of masks to keep
|
||||
sam_points_per_batch: 64
|
||||
compressor_path: null # Path to trained HashCompressor weights (optional)
|
||||
|
||||
output:
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
from pathlib import Path
|
||||
from typing import Literal, Optional
|
||||
|
||||
from pydantic import BaseModel, ConfigDict, Field, field_validator
|
||||
from pydantic import AliasChoices, BaseModel, ConfigDict, Field, field_validator
|
||||
|
||||
|
||||
class ModelConfig(BaseModel):
|
||||
@@ -11,7 +11,10 @@ class ModelConfig(BaseModel):
|
||||
|
||||
model_config = ConfigDict(extra="ignore")
|
||||
|
||||
dino_model: str = "facebook/dinov2-large"
|
||||
dino_model: str = Field(
|
||||
default="facebook/dinov2-large",
|
||||
validation_alias=AliasChoices("dino_model", "name"),
|
||||
)
|
||||
compression_dim: int = Field(
|
||||
default=512, gt=0, description="Output feature dimension"
|
||||
)
|
||||
@@ -26,6 +29,11 @@ class ModelConfig(BaseModel):
|
||||
sam_max_masks: int = Field(
|
||||
default=10, gt=0, description="Maximum number of masks to keep"
|
||||
)
|
||||
sam_points_per_batch: int = Field(
|
||||
default=64,
|
||||
gt=0,
|
||||
description="SAM2 mask generation batch size for prompt points",
|
||||
)
|
||||
compressor_path: Optional[str] = Field(
|
||||
default=None, description="Path to trained HashCompressor weights"
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user