Zhen Ye Claude Opus 4.6 commited on
Commit
05bd36a
·
1 Parent(s): 0719ba5

feat: expose step param on /detect/async, default to 7

Browse files

Step=7 matches num_maskmem and reduces TTFS by shrinking the first
SAM2 propagation segment from 60 frames to 7. Benchmark shows
negligible end-to-end overhead (YOLO detection is fast).

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

Files changed (3) hide show
  1. app.py +2 -0
  2. jobs/background.py +1 -1
  3. jobs/models.py +1 -0
app.py CHANGED
@@ -409,6 +409,7 @@ async def detect_async_endpoint(
409
  depth_scale: float = Form(25.0),
410
  enable_depth: bool = Form(False),
411
  enable_gpt: bool = Form(True),
 
412
  ):
413
  _ttfs_t0 = time.perf_counter()
414
 
@@ -533,6 +534,7 @@ async def detect_async_endpoint(
533
  mission_spec=mission_spec,
534
  mission_mode=mission_mode,
535
  first_frame_gpt_results=first_frame_gpt_results,
 
536
  ttfs_t0=_ttfs_t0,
537
  )
538
  get_job_storage().create(job)
 
409
  depth_scale: float = Form(25.0),
410
  enable_depth: bool = Form(False),
411
  enable_gpt: bool = Form(True),
412
+ step: int = Form(7),
413
  ):
414
  _ttfs_t0 = time.perf_counter()
415
 
 
534
  mission_spec=mission_spec,
535
  mission_mode=mission_mode,
536
  first_frame_gpt_results=first_frame_gpt_results,
537
+ step=step,
538
  ttfs_t0=_ttfs_t0,
539
  )
540
  get_job_storage().create(job)
jobs/background.py CHANGED
@@ -34,7 +34,7 @@ async def process_video_async(job_id: str) -> None:
34
  segmenter_name=job.segmenter_name,
35
  job_id=job_id,
36
  stream_queue=stream_queue,
37
- step=60,
38
  enable_gpt=job.enable_gpt,
39
  mission_spec=job.mission_spec,
40
  first_frame_gpt_results=job.first_frame_gpt_results,
 
34
  segmenter_name=job.segmenter_name,
35
  job_id=job_id,
36
  stream_queue=stream_queue,
37
+ step=job.step,
38
  enable_gpt=job.enable_gpt,
39
  mission_spec=job.mission_spec,
40
  first_frame_gpt_results=job.first_frame_gpt_results,
jobs/models.py CHANGED
@@ -38,4 +38,5 @@ class JobInfo:
38
  mission_spec: Optional[Any] = None # utils.schemas.MissionSpecification
39
  mission_mode: str = "LEGACY" # "MISSION" or "LEGACY"
40
  first_frame_gpt_results: Optional[Dict[str, Any]] = None # Cached GPT results from process_first_frame
 
41
  ttfs_t0: Optional[float] = None # TTFS anchor: time.perf_counter() at endpoint entry
 
38
  mission_spec: Optional[Any] = None # utils.schemas.MissionSpecification
39
  mission_mode: str = "LEGACY" # "MISSION" or "LEGACY"
40
  first_frame_gpt_results: Optional[Dict[str, Any]] = None # Cached GPT results from process_first_frame
41
+ step: int = 7 # Segmentation keyframe step (matches num_maskmem)
42
  ttfs_t0: Optional[float] = None # TTFS anchor: time.perf_counter() at endpoint entry