Zhen Ye Claude Opus 4.6 commited on
Commit
e9834ad
·
1 Parent(s): 1c6c619

perf: set num_maskmem=3 for all inference paths

Browse files

Reduces SAM2 temporal memory bank from 7 to 3 frames on both the
sync /detect endpoint and the async background job path to lower
GPU memory usage with minimal tracking quality impact.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

Files changed (2) hide show
  1. app.py +1 -0
  2. jobs/background.py +1 -0
app.py CHANGED
@@ -302,6 +302,7 @@ async def detect_endpoint(
302
  output_path,
303
  query_list,
304
  segmenter_name=segmenter,
 
305
  )
306
  except ValueError as exc:
307
  logging.exception("Segmentation processing failed.")
 
302
  output_path,
303
  query_list,
304
  segmenter_name=segmenter,
305
+ num_maskmem=3,
306
  )
307
  except ValueError as exc:
308
  logging.exception("Segmentation processing failed.")
jobs/background.py CHANGED
@@ -40,6 +40,7 @@ async def process_video_async(job_id: str) -> None:
40
  enable_gpt=job.enable_gpt,
41
  mission_spec=job.mission_spec,
42
  first_frame_gpt_results=job.first_frame_gpt_results,
 
43
  )
44
  else:
45
  detections_list = None
 
40
  enable_gpt=job.enable_gpt,
41
  mission_spec=job.mission_spec,
42
  first_frame_gpt_results=job.first_frame_gpt_results,
43
+ num_maskmem=3,
44
  )
45
  else:
46
  detections_list = None