please fix

This commit is contained in:
2025-07-26 08:43:18 -07:00
parent a7c7cfbcba
commit eb9529b4ff
2 changed files with 4 additions and 17 deletions

View File

@@ -14,7 +14,7 @@ matting:
use_disparity_mapping: true use_disparity_mapping: true
memory_offload: false # A40 has enough VRAM memory_offload: false # A40 has enough VRAM
fp16: true fp16: true
sam2_model_cfg: "sam2.1_hiera_l" sam2_model_cfg: "configs/sam2.1/sam2.1_hiera_l.yaml"
sam2_checkpoint: "segment-anything-2/checkpoints/sam2.1_hiera_large.pt" sam2_checkpoint: "segment-anything-2/checkpoints/sam2.1_hiera_large.pt"
output: output:

View File

@@ -57,23 +57,10 @@ class SAM2VideoMatting:
if sam2_repo_path.exists(): if sam2_repo_path.exists():
checkpoint_path = str(sam2_repo_path) checkpoint_path = str(sam2_repo_path)
# Handle config path - if it contains a dot, look for the actual file # Use the config path as-is (should be relative to SAM2 package)
config_path = model_cfg # Example: "configs/sam2.1/sam2.1_hiera_l.yaml"
if not model_cfg.endswith('.yaml'):
# Try to find the config file in SAM2 repo structure
sam2_config_paths = [
Path("segment-anything-2/sam2/configs/sam2.1") / f"{model_cfg}.yaml",
Path("segment-anything-2/sam2/configs/sam2") / f"{model_cfg}.yaml",
Path("segment-anything-2/sam2") / f"{model_cfg}.yaml"
]
for config_file_path in sam2_config_paths:
if config_file_path.exists():
config_path = str(config_file_path)
break
self.predictor = build_sam2_video_predictor( self.predictor = build_sam2_video_predictor(
config_path, model_cfg,
checkpoint_path, checkpoint_path,
device=self.device device=self.device
) )