samannot 0.6.1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,378 @@
1
+ """SAM 2 Model Weights Downloader GUI and utilities."""
2
+
3
+ import os
4
+ import ssl
5
+ import sys
6
+ import time
7
+ import threading
8
+ import tkinter as tk
9
+ from tkinter import ttk, filedialog, messagebox
10
+ from pathlib import Path
11
+ import urllib.request
12
+
13
+ SAM2P1_BASE_URL = "https://dl.fbaipublicfiles.com/segment_anything_2/092824"
14
+
15
+ MODELS = {
16
+ "SAM 2.1 Large (Recommended)": {
17
+ "filename": "sam2.1_hiera_large.pt",
18
+ "url": f"{SAM2P1_BASE_URL}/sam2.1_hiera_large.pt",
19
+ "size_mb": 856.5,
20
+ "default": True,
21
+ },
22
+ "SAM 2.1 Base+": {
23
+ "filename": "sam2.1_hiera_base_plus.pt",
24
+ "url": f"{SAM2P1_BASE_URL}/sam2.1_hiera_base_plus.pt",
25
+ "size_mb": 308.5,
26
+ "default": False,
27
+ },
28
+ "SAM 2.1 Small": {
29
+ "filename": "sam2.1_hiera_small.pt",
30
+ "url": f"{SAM2P1_BASE_URL}/sam2.1_hiera_small.pt",
31
+ "size_mb": 177.3,
32
+ "default": False,
33
+ },
34
+ "SAM 2.1 Tiny": {
35
+ "filename": "sam2.1_hiera_tiny.pt",
36
+ "url": f"{SAM2P1_BASE_URL}/sam2.1_hiera_tiny.pt",
37
+ "size_mb": 143.6,
38
+ "default": False,
39
+ },
40
+ }
41
+
42
+
43
+ def get_checkpoint_dir() -> Path:
44
+ """Return default directory for checkpoints (local checkpoints/ or user cache)."""
45
+ local_dir = Path.cwd() / "checkpoints"
46
+ if local_dir.is_dir():
47
+ return local_dir.resolve()
48
+
49
+ repo_dir = Path(__file__).resolve().parent.parent / "checkpoints"
50
+ if repo_dir.is_dir():
51
+ return repo_dir.resolve()
52
+
53
+ cache_dir = Path.home() / ".cache" / "samannot" / "checkpoints"
54
+ cache_dir.mkdir(parents=True, exist_ok=True)
55
+ return cache_dir.resolve()
56
+
57
+
58
+ def download_file(url: str, dest_path: Path, progress_callback=None, cancel_event: threading.Event = None) -> bool:
59
+ """Download a file with chunked progress reporting and cancellation support."""
60
+ dest_path.parent.mkdir(parents=True, exist_ok=True)
61
+ temp_path = dest_path.with_suffix(dest_path.suffix + ".downloading")
62
+
63
+ ctx = ssl.create_default_context()
64
+ try:
65
+ ctx.check_hostname = False
66
+ ctx.verify_mode = ssl.CERT_NONE
67
+ except Exception:
68
+ pass
69
+
70
+ req = urllib.request.Request(url, headers={"User-Agent": "SAMannot-Downloader/1.0"})
71
+
72
+ try:
73
+ with urllib.request.urlopen(req, context=ctx) as response:
74
+ total_size = int(response.headers.get("Content-Length", 0))
75
+ downloaded = 0
76
+ start_time = time.time()
77
+ chunk_size = 1024 * 1024 # 1 MB chunk
78
+
79
+ with open(temp_path, "wb") as f:
80
+ while True:
81
+ if cancel_event and cancel_event.is_set():
82
+ f.close()
83
+ if temp_path.exists():
84
+ temp_path.unlink()
85
+ return False
86
+
87
+ chunk = response.read(chunk_size)
88
+ if not chunk:
89
+ break
90
+
91
+ f.write(chunk)
92
+ downloaded += len(chunk)
93
+ elapsed = time.time() - start_time
94
+ speed = downloaded / elapsed if elapsed > 0 else 0
95
+
96
+ if progress_callback:
97
+ progress_callback(downloaded, total_size, speed)
98
+
99
+ if temp_path.exists():
100
+ if dest_path.exists():
101
+ dest_path.unlink()
102
+ temp_path.rename(dest_path)
103
+ return True
104
+ return False
105
+ except Exception as e:
106
+ if temp_path.exists():
107
+ try:
108
+ temp_path.unlink()
109
+ except Exception:
110
+ pass
111
+ raise e
112
+
113
+
114
+ class ModelDownloaderWindow(tk.Toplevel):
115
+ """GUI Window for downloading SAM 2 model weights."""
116
+
117
+ def __init__(self, parent=None, on_complete_callback=None):
118
+ super().__init__(parent)
119
+ self.parent = parent
120
+ self.on_complete_callback = on_complete_callback
121
+
122
+ self.title("Download SAM 2 Model Weights")
123
+ self.geometry("620x460")
124
+ self.minsize(560, 420)
125
+ self.configure(bg="#f5f6f7")
126
+
127
+ self.cancel_event = threading.Event()
128
+ self.download_thread = None
129
+ self.is_downloading = False
130
+
131
+ self.target_dir_var = tk.StringVar(value=str(get_checkpoint_dir()))
132
+ self.selected_model_var = tk.StringVar(value="SAM 2.1 Large (Recommended)")
133
+ self.status_var = tk.StringVar(value="Ready to download.")
134
+ self.progress_detail_var = tk.StringVar(value="")
135
+
136
+ self.create_widgets()
137
+ self.refresh_model_status()
138
+ self.protocol("WM_DELETE_WINDOW", self.on_close)
139
+
140
+ def create_widgets(self):
141
+ main_frame = ttk.Frame(self, padding=16)
142
+ main_frame.pack(fill=tk.BOTH, expand=True)
143
+
144
+ # Header
145
+ header_label = ttk.Label(
146
+ main_frame,
147
+ text="SAM 2 Model Weights Downloader",
148
+ font=("Segoe UI", 13, "bold"),
149
+ )
150
+ header_label.pack(anchor="w", pady=(0, 4))
151
+
152
+ info_label = ttk.Label(
153
+ main_frame,
154
+ text="SAMannot requires model checkpoint weights to perform segmentation and tracking.\n"
155
+ "Select a model variant below to download it into your checkpoints directory.",
156
+ font=("Segoe UI", 9),
157
+ foreground="#555555",
158
+ justify="left",
159
+ )
160
+ info_label.pack(anchor="w", pady=(0, 12))
161
+
162
+ # Target directory frame
163
+ dir_frame = ttk.LabelFrame(main_frame, text="Download Destination", padding=8)
164
+ dir_frame.pack(fill=tk.X, pady=(0, 12))
165
+
166
+ dir_entry = ttk.Entry(dir_frame, textvariable=self.target_dir_var)
167
+ dir_entry.pack(side=tk.LEFT, fill=tk.X, expand=True, padx=(0, 6))
168
+
169
+ browse_btn = ttk.Button(dir_frame, text="Browse...", command=self.browse_target_dir)
170
+ browse_btn.pack(side=tk.RIGHT)
171
+
172
+ # Model selection frame
173
+ models_frame = ttk.LabelFrame(main_frame, text="Select Model Checkpoint", padding=8)
174
+ models_frame.pack(fill=tk.BOTH, expand=True, pady=(0, 12))
175
+
176
+ self.model_radios = {}
177
+ self.status_labels = {}
178
+ row = 0
179
+ for name, meta in MODELS.items():
180
+ r = ttk.Radiobutton(
181
+ models_frame,
182
+ text=f"{name} ({meta['size_mb']:.1f} MB)",
183
+ value=name,
184
+ variable=self.selected_model_var,
185
+ command=self.refresh_model_status,
186
+ )
187
+ r.grid(row=row, column=0, sticky="w", pady=3)
188
+
189
+ lbl = ttk.Label(models_frame, text="", font=("Segoe UI", 9, "italic"))
190
+ lbl.grid(row=row, column=1, sticky="e", padx=(10, 0), pady=3)
191
+ models_frame.columnconfigure(1, weight=1)
192
+
193
+ self.model_radios[name] = r
194
+ self.status_labels[name] = lbl
195
+ row += 1
196
+
197
+ # Progress frame
198
+ progress_frame = ttk.Frame(main_frame)
199
+ progress_frame.pack(fill=tk.X, pady=(0, 12))
200
+
201
+ self.progressbar = ttk.Progressbar(progress_frame, mode="determinate", maximum=100)
202
+ self.progressbar.pack(fill=tk.X, pady=(0, 4))
203
+
204
+ self.progress_detail_label = ttk.Label(
205
+ progress_frame,
206
+ textvariable=self.progress_detail_var,
207
+ font=("Segoe UI", 9),
208
+ foreground="#444444",
209
+ )
210
+ self.progress_detail_label.pack(anchor="w")
211
+
212
+ # Bottom buttons
213
+ btn_frame = ttk.Frame(main_frame)
214
+ btn_frame.pack(fill=tk.X)
215
+
216
+ self.status_label = ttk.Label(
217
+ btn_frame,
218
+ textvariable=self.status_var,
219
+ font=("Segoe UI", 9),
220
+ foreground="#222222",
221
+ )
222
+ self.status_label.pack(side=tk.LEFT, fill=tk.X, expand=True)
223
+
224
+ self.cancel_btn = ttk.Button(btn_frame, text="Cancel", command=self.cancel_download, state=tk.DISABLED)
225
+ self.cancel_btn.pack(side=tk.RIGHT, padx=(6, 0))
226
+
227
+ self.download_btn = ttk.Button(btn_frame, text="Download", command=self.start_download)
228
+ self.download_btn.pack(side=tk.RIGHT)
229
+
230
+ def browse_target_dir(self):
231
+ chosen = filedialog.askdirectory(initialdir=self.target_dir_var.get(), title="Select Checkpoint Folder")
232
+ if chosen:
233
+ self.target_dir_var.set(chosen)
234
+ self.refresh_model_status()
235
+
236
+ def refresh_model_status(self):
237
+ target_dir = Path(self.target_dir_var.get())
238
+ for name, meta in MODELS.items():
239
+ dest = target_dir / meta["filename"]
240
+ lbl = self.status_labels.get(name)
241
+ if lbl:
242
+ if dest.exists() and dest.stat().st_size > 1024 * 1024:
243
+ size_mb = dest.stat().st_size / (1024 * 1024)
244
+ lbl.config(text=f"Installed ({size_mb:.1f} MB)", foreground="#2e7d32")
245
+ else:
246
+ lbl.config(text="Not downloaded", foreground="#c62828")
247
+
248
+ def start_download(self):
249
+ if self.is_downloading:
250
+ return
251
+
252
+ selected_name = self.selected_model_var.get()
253
+ meta = MODELS.get(selected_name)
254
+ if not meta:
255
+ return
256
+
257
+ target_dir = Path(self.target_dir_var.get())
258
+ dest_path = target_dir / meta["filename"]
259
+
260
+ if dest_path.exists():
261
+ if not messagebox.askyesno(
262
+ "Overwrite Existing Model",
263
+ f"{meta['filename']} already exists in the destination folder.\nDo you want to re-download and overwrite it?",
264
+ parent=self,
265
+ ):
266
+ return
267
+
268
+ self.is_downloading = True
269
+ self.cancel_event.clear()
270
+ self.download_btn.config(state=tk.DISABLED)
271
+ self.cancel_btn.config(state=tk.NORMAL)
272
+ self.status_var.set(f"Connecting to download {meta['filename']}...")
273
+ self.progressbar["value"] = 0
274
+
275
+ self.download_thread = threading.Thread(
276
+ target=self._download_worker,
277
+ args=(meta["url"], dest_path),
278
+ daemon=True,
279
+ )
280
+ self.download_thread.start()
281
+
282
+ def _download_worker(self, url: str, dest_path: Path):
283
+ def on_progress(downloaded, total, speed):
284
+ pct = (downloaded / total * 100) if total > 0 else 0
285
+ dl_mb = downloaded / (1024 * 1024)
286
+ tot_mb = total / (1024 * 1024)
287
+ speed_mb = speed / (1024 * 1024)
288
+ self.after(0, lambda: self._update_progress_ui(pct, dl_mb, tot_mb, speed_mb))
289
+
290
+ try:
291
+ success = download_file(url, dest_path, progress_callback=on_progress, cancel_event=self.cancel_event)
292
+ if success:
293
+ self.after(0, lambda: self._on_download_success(dest_path))
294
+ else:
295
+ self.after(0, lambda: self._on_download_cancelled())
296
+ except Exception as e:
297
+ self.after(0, lambda: self._on_download_error(str(e)))
298
+
299
+ def _update_progress_ui(self, pct: float, dl_mb: float, tot_mb: float, speed_mb: float):
300
+ self.progressbar["value"] = pct
301
+ self.progress_detail_var.set(
302
+ f"{pct:.1f}% — {dl_mb:.1f} MB / {tot_mb:.1f} MB ({speed_mb:.1f} MB/s)"
303
+ )
304
+ self.status_var.set("Downloading weights...")
305
+
306
+ def _on_download_success(self, dest_path: Path):
307
+ self.is_downloading = False
308
+ self.download_btn.config(state=tk.NORMAL)
309
+ self.cancel_btn.config(state=tk.DISABLED)
310
+ self.progressbar["value"] = 100
311
+ self.status_var.set("Download completed successfully!")
312
+ self.refresh_model_status()
313
+
314
+ messagebox.showinfo(
315
+ "Download Complete",
316
+ f"The download is complete!\n\nModel weights saved to:\n{dest_path}",
317
+ parent=self,
318
+ )
319
+
320
+ callback = self.on_complete_callback
321
+ self.destroy()
322
+
323
+ if callback:
324
+ callback(str(dest_path))
325
+
326
+ def _on_download_cancelled(self):
327
+ self.is_downloading = False
328
+ self.download_btn.config(state=tk.NORMAL)
329
+ self.cancel_btn.config(state=tk.DISABLED)
330
+ self.progressbar["value"] = 0
331
+ self.progress_detail_var.set("")
332
+ self.status_var.set("Download cancelled.")
333
+ self.refresh_model_status()
334
+
335
+ def _on_download_error(self, err_msg: str):
336
+ self.is_downloading = False
337
+ self.download_btn.config(state=tk.NORMAL)
338
+ self.cancel_btn.config(state=tk.DISABLED)
339
+ self.status_var.set("Download failed.")
340
+ messagebox.showerror("Download Error", f"Failed to download model weights:\n{err_msg}", parent=self)
341
+ self.refresh_model_status()
342
+
343
+ def cancel_download(self):
344
+ if self.is_downloading:
345
+ self.status_var.set("Cancelling download...")
346
+ self.cancel_event.set()
347
+
348
+ def on_close(self):
349
+ if self.is_downloading:
350
+ if messagebox.askyesno("Cancel Download", "A download is currently in progress. Cancel and exit?", parent=self):
351
+ self.cancel_event.set()
352
+ self.destroy()
353
+ else:
354
+ self.destroy()
355
+
356
+
357
+ def open_downloader(parent=None, on_complete_callback=None):
358
+ """Helper function to open the ModelDownloaderWindow."""
359
+ win = ModelDownloaderWindow(parent=parent, on_complete_callback=on_complete_callback)
360
+ win.lift()
361
+ win.focus_force()
362
+ return win
363
+
364
+
365
+ def main():
366
+ """Standalone CLI / script entry point."""
367
+ root = tk.Tk()
368
+ root.withdraw()
369
+ win = ModelDownloaderWindow(parent=root, on_complete_callback=lambda p: print(f"Downloaded to {p}"))
370
+ win.wait_window()
371
+ try:
372
+ root.destroy()
373
+ except Exception:
374
+ pass
375
+
376
+
377
+ if __name__ == "__main__":
378
+ main()
@@ -0,0 +1,5 @@
1
+ # Copyright (c) Meta Platforms, Inc. and affiliates.
2
+ # All rights reserved.
3
+
4
+ # This source code is licensed under the license found in the
5
+ # LICENSE file in the root directory of this source tree.
@@ -0,0 +1,120 @@
1
+ # @package _global_
2
+
3
+ # Model
4
+ model:
5
+ _target_: sam2.modeling.sam2_base.SAM2Base
6
+ image_encoder:
7
+ _target_: sam2.modeling.backbones.image_encoder.ImageEncoder
8
+ scalp: 1
9
+ trunk:
10
+ _target_: sam2.modeling.backbones.hieradet.Hiera
11
+ embed_dim: 144
12
+ num_heads: 2
13
+ stages: [2, 6, 36, 4]
14
+ global_att_blocks: [23, 33, 43]
15
+ window_pos_embed_bkg_spatial_size: [7, 7]
16
+ window_spec: [8, 4, 16, 8]
17
+ neck:
18
+ _target_: sam2.modeling.backbones.image_encoder.FpnNeck
19
+ position_encoding:
20
+ _target_: sam2.modeling.position_encoding.PositionEmbeddingSine
21
+ num_pos_feats: 256
22
+ normalize: true
23
+ scale: null
24
+ temperature: 10000
25
+ d_model: 256
26
+ backbone_channel_list: [1152, 576, 288, 144]
27
+ fpn_top_down_levels: [2, 3] # output level 0 and 1 directly use the backbone features
28
+ fpn_interp_model: nearest
29
+
30
+ memory_attention:
31
+ _target_: sam2.modeling.memory_attention.MemoryAttention
32
+ d_model: 256
33
+ pos_enc_at_input: true
34
+ layer:
35
+ _target_: sam2.modeling.memory_attention.MemoryAttentionLayer
36
+ activation: relu
37
+ dim_feedforward: 2048
38
+ dropout: 0.1
39
+ pos_enc_at_attn: false
40
+ self_attention:
41
+ _target_: sam2.modeling.sam.transformer.RoPEAttention
42
+ rope_theta: 10000.0
43
+ feat_sizes: [64, 64]
44
+ embedding_dim: 256
45
+ num_heads: 1
46
+ downsample_rate: 1
47
+ dropout: 0.1
48
+ d_model: 256
49
+ pos_enc_at_cross_attn_keys: true
50
+ pos_enc_at_cross_attn_queries: false
51
+ cross_attention:
52
+ _target_: sam2.modeling.sam.transformer.RoPEAttention
53
+ rope_theta: 10000.0
54
+ feat_sizes: [64, 64]
55
+ rope_k_repeat: True
56
+ embedding_dim: 256
57
+ num_heads: 1
58
+ downsample_rate: 1
59
+ dropout: 0.1
60
+ kv_in_dim: 64
61
+ num_layers: 4
62
+
63
+ memory_encoder:
64
+ _target_: sam2.modeling.memory_encoder.MemoryEncoder
65
+ out_dim: 64
66
+ position_encoding:
67
+ _target_: sam2.modeling.position_encoding.PositionEmbeddingSine
68
+ num_pos_feats: 64
69
+ normalize: true
70
+ scale: null
71
+ temperature: 10000
72
+ mask_downsampler:
73
+ _target_: sam2.modeling.memory_encoder.MaskDownSampler
74
+ kernel_size: 3
75
+ stride: 2
76
+ padding: 1
77
+ fuser:
78
+ _target_: sam2.modeling.memory_encoder.Fuser
79
+ layer:
80
+ _target_: sam2.modeling.memory_encoder.CXBlock
81
+ dim: 256
82
+ kernel_size: 7
83
+ padding: 3
84
+ layer_scale_init_value: 1e-6
85
+ use_dwconv: True # depth-wise convs
86
+ num_layers: 2
87
+
88
+ num_maskmem: 7
89
+ image_size: 1024
90
+ # apply scaled sigmoid on mask logits for memory encoder, and directly feed input mask as output mask
91
+ sigmoid_scale_for_mem_enc: 20.0
92
+ sigmoid_bias_for_mem_enc: -10.0
93
+ use_mask_input_as_output_without_sam: true
94
+ # Memory
95
+ directly_add_no_mem_embed: true
96
+ no_obj_embed_spatial: true
97
+ # use high-resolution feature map in the SAM mask decoder
98
+ use_high_res_features_in_sam: true
99
+ # output 3 masks on the first click on initial conditioning frames
100
+ multimask_output_in_sam: true
101
+ # SAM heads
102
+ iou_prediction_use_sigmoid: True
103
+ # cross-attend to object pointers from other frames (based on SAM output tokens) in the encoder
104
+ use_obj_ptrs_in_encoder: true
105
+ add_tpos_enc_to_obj_ptrs: true
106
+ proj_tpos_enc_in_obj_ptrs: true
107
+ use_signed_tpos_enc_to_obj_ptrs: true
108
+ only_obj_ptrs_in_the_past_for_eval: true
109
+ # object occlusion prediction
110
+ pred_obj_scores: true
111
+ pred_obj_scores_mlp: true
112
+ fixed_no_obj_ptr: true
113
+ # multimask tracking settings
114
+ multimask_output_for_tracking: true
115
+ use_multimask_token_for_obj_ptr: true
116
+ multimask_min_pt_num: 0
117
+ multimask_max_pt_num: 1
118
+ use_mlp_for_obj_ptr_proj: true
119
+ # Compilation flag
120
+ compile_image_encoder: False
@@ -0,0 +1,113 @@
1
+ # @package _global_
2
+
3
+ # Model
4
+ model:
5
+ _target_: sam2.modeling.sam2_base.SAM2Base
6
+ image_encoder:
7
+ _target_: sam2.modeling.backbones.image_encoder.ImageEncoder
8
+ scalp: 1
9
+ trunk:
10
+ _target_: sam2.modeling.backbones.hieradet.Hiera
11
+ embed_dim: 112
12
+ num_heads: 2
13
+ neck:
14
+ _target_: sam2.modeling.backbones.image_encoder.FpnNeck
15
+ position_encoding:
16
+ _target_: sam2.modeling.position_encoding.PositionEmbeddingSine
17
+ num_pos_feats: 256
18
+ normalize: true
19
+ scale: null
20
+ temperature: 10000
21
+ d_model: 256
22
+ backbone_channel_list: [896, 448, 224, 112]
23
+ fpn_top_down_levels: [2, 3] # output level 0 and 1 directly use the backbone features
24
+ fpn_interp_model: nearest
25
+
26
+ memory_attention:
27
+ _target_: sam2.modeling.memory_attention.MemoryAttention
28
+ d_model: 256
29
+ pos_enc_at_input: true
30
+ layer:
31
+ _target_: sam2.modeling.memory_attention.MemoryAttentionLayer
32
+ activation: relu
33
+ dim_feedforward: 2048
34
+ dropout: 0.1
35
+ pos_enc_at_attn: false
36
+ self_attention:
37
+ _target_: sam2.modeling.sam.transformer.RoPEAttention
38
+ rope_theta: 10000.0
39
+ feat_sizes: [64, 64]
40
+ embedding_dim: 256
41
+ num_heads: 1
42
+ downsample_rate: 1
43
+ dropout: 0.1
44
+ d_model: 256
45
+ pos_enc_at_cross_attn_keys: true
46
+ pos_enc_at_cross_attn_queries: false
47
+ cross_attention:
48
+ _target_: sam2.modeling.sam.transformer.RoPEAttention
49
+ rope_theta: 10000.0
50
+ feat_sizes: [64, 64]
51
+ rope_k_repeat: True
52
+ embedding_dim: 256
53
+ num_heads: 1
54
+ downsample_rate: 1
55
+ dropout: 0.1
56
+ kv_in_dim: 64
57
+ num_layers: 4
58
+
59
+ memory_encoder:
60
+ _target_: sam2.modeling.memory_encoder.MemoryEncoder
61
+ out_dim: 64
62
+ position_encoding:
63
+ _target_: sam2.modeling.position_encoding.PositionEmbeddingSine
64
+ num_pos_feats: 64
65
+ normalize: true
66
+ scale: null
67
+ temperature: 10000
68
+ mask_downsampler:
69
+ _target_: sam2.modeling.memory_encoder.MaskDownSampler
70
+ kernel_size: 3
71
+ stride: 2
72
+ padding: 1
73
+ fuser:
74
+ _target_: sam2.modeling.memory_encoder.Fuser
75
+ layer:
76
+ _target_: sam2.modeling.memory_encoder.CXBlock
77
+ dim: 256
78
+ kernel_size: 7
79
+ padding: 3
80
+ layer_scale_init_value: 1e-6
81
+ use_dwconv: True # depth-wise convs
82
+ num_layers: 2
83
+
84
+ num_maskmem: 7
85
+ image_size: 1024
86
+ # apply scaled sigmoid on mask logits for memory encoder, and directly feed input mask as output mask
87
+ sigmoid_scale_for_mem_enc: 20.0
88
+ sigmoid_bias_for_mem_enc: -10.0
89
+ use_mask_input_as_output_without_sam: true
90
+ # Memory
91
+ directly_add_no_mem_embed: true
92
+ # use high-resolution feature map in the SAM mask decoder
93
+ use_high_res_features_in_sam: true
94
+ # output 3 masks on the first click on initial conditioning frames
95
+ multimask_output_in_sam: true
96
+ # SAM heads
97
+ iou_prediction_use_sigmoid: True
98
+ # cross-attend to object pointers from other frames (based on SAM output tokens) in the encoder
99
+ use_obj_ptrs_in_encoder: true
100
+ add_tpos_enc_to_obj_ptrs: false
101
+ only_obj_ptrs_in_the_past_for_eval: true
102
+ # object occlusion prediction
103
+ pred_obj_scores: true
104
+ pred_obj_scores_mlp: true
105
+ fixed_no_obj_ptr: true
106
+ # multimask tracking settings
107
+ multimask_output_for_tracking: true
108
+ use_multimask_token_for_obj_ptr: true
109
+ multimask_min_pt_num: 0
110
+ multimask_max_pt_num: 1
111
+ use_mlp_for_obj_ptr_proj: true
112
+ # Compilation flag
113
+ compile_image_encoder: False