Skip to content

Commit 3deb400

Browse files
authored
Merge pull request #989 from keejkrej/fix/model_download
Downloads model weights for promptable sam and sam2 when user tries to use them first time
2 parents 72d6938 + c57442c commit 3deb400

File tree

3 files changed

+15
-4
lines changed

3 files changed

+15
-4
lines changed

cellacdc/__init__.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -525,11 +525,18 @@ def printl(*objects, pretty=False, is_decorator=False, idx=1, **kwargs):
525525
]
526526

527527
segment_anything_weights_filenames = [
528-
'sam_vit_h_4b8939.pth',
529-
'sam_vit_l_0b3195.pth',
528+
'sam_vit_h_4b8939.pth',
529+
'sam_vit_l_0b3195.pth',
530530
'sam_vit_b_01ec64.pth'
531531
]
532532

533+
sam2_weights_filenames = [
534+
'sam2.1_hiera_large.pt',
535+
'sam2.1_hiera_base_plus.pt',
536+
'sam2.1_hiera_small.pt',
537+
'sam2.1_hiera_tiny.pt'
538+
]
539+
533540
deepsea_weights_filenames = [
534541
'segmentation.pth',
535542
'tracker.pth'

cellacdc/widgets.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11102,7 +11102,11 @@ def selectModel(self):
1110211102

1110311103
model_name = win.model_name
1110411104
print(f'Importing promptable model {model_name}...')
11105-
11105+
11106+
# Download model weights, consistent with gui.py
11107+
downloadWin = apps.downloadModel(model_name, parent=self._parent)
11108+
downloadWin.download()
11109+
1110611110
acdcPromptSegment = myutils.import_promptable_segment_module(model_name)
1110711111
init_argspecs, segment_argspecs = myutils.getModelArgSpec(
1110811112
acdcPromptSegment

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ dependencies = [
5050
"boto3",
5151
"requests",
5252
"setuptools-scm",
53+
"matplotlib"
5354
]
5455
dynamic = [
5556
"version",
@@ -148,7 +149,6 @@ all = [
148149
dev = [
149150
"pytest",
150151
"pytest-cov",
151-
"matplotlib",
152152
]
153153

154154
[project.scripts]

0 commit comments

Comments
 (0)