Compare commits
2 Commits
98128b8099
...
a7c7cfbcba
| Author | SHA1 | Date | |
|---|---|---|---|
| a7c7cfbcba | |||
| 6ea3d3ae5d |
@@ -57,8 +57,23 @@ class SAM2VideoMatting:
|
||||
if sam2_repo_path.exists():
|
||||
checkpoint_path = str(sam2_repo_path)
|
||||
|
||||
# Handle config path - if it contains a dot, look for the actual file
|
||||
config_path = model_cfg
|
||||
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(
|
||||
model_cfg,
|
||||
config_path,
|
||||
checkpoint_path,
|
||||
device=self.device
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user