开源引擎 tamserve 让单卡同时追踪多路摄像头

原标题:Show HN: Open-source, real-time object tracking for live video feeds
62AI 研判分

tamserve 是面向 SAM 2 与 EdgeTAM 的开源实时服务引擎,把原本只支持单段录制视频的模型代码改造成多摄像头共享同一份模型权重的推理服务,单张 GPU 可同时处理六路 30 帧/秒直播流。它支持点选目标或直接用自然语言命名目标(如“狗”“红色杯子”)进行追踪,思路类似 vLLM 对 LLM 推理的批处理与显存复用。

报道正文

本文目录2 个章节

tamserve Live, multi-camera tracking with SAM 2, on one GPU or many. SAM 2 and its smaller sibling EdgeTAM can track anything you point at, but their code was written for one recorded video at a time. tamserve is the serving engine they are missing: one copy of the model tracks every object on every camera, for as long as the cameras run. Point at what to track, or name it ("dog", "the red mug") and tamserve finds it. Why tamserve · New to video tracking? · Using it · Tracking by name · How it works · Results · Limits Six live cameras on one GPU, every one at 30 frames/s. Watch the 32-second demo , or read how it was recorded .

Why tamserve

The models are excellent. The code that comes with them was made for editing one recorded video, and the usual way to put it on several cameras is to run a separate copy of the model for each one. Memory piles up with every copy and with every minute of video.

tamserve does what LLM servers such as vLLM do for chat: every camera shares one copy of the model, and whatever needs the GPU at a given moment goes through it together. That turns out to be faster as well as lighter, and because the model itself is not touched, the results are the same.

the model's own codetamserve
Several camerasone copy of the model per cameraone copy for all of them
GPU memory, 8 cameras8.6 GB2.2 GB
Speed, 1 camera177 frames/s219 frames/s
Speed, 8 cameras280 frames/s323 frames/s
64 cameraswould need about 70 GB of GPU memory321 frames/s in 5.7 GB
GPU memory for an 800-frame video9.8 GB0.28 GB, however long it runs
Starting to track something new mid-streamnot possibleon any frame
Finding what to trackyou point at each objectyou point, or you name it and a Tracker finds and follows every match by itself
Several GPUsyou split the cameras between them by handa Router places the cameras and gathers every result
Accuracy on DAVIS 20170.86860.8685

These are for EdgeTAM on one RTX 4090, against EdgeTAM's own code at its fastest: compiled, one copy per camera, all sharing the GPU. Speeds are totals across the cameras, with one object each. With the larger SAM 2.1 models, tamserve runs at the same speed as Meta's current SAM 2 code and uses about a third of the GPU memory. Results has the full tables.

New to video tracking?

Say you have video, and you need to know where one particular thing is in every frame: this person, that forklift, the dog. That is tracking. SAM 2 and its smaller relatives, EdgeTAM and SAM 2.1, are models from Meta that do it very well. You point at the thing once, on a single frame, and the model draws its exact outline on every frame after that.

tamserve sits between one of those models and your program. Your program hands it the latest frame from each camera and gets back the outline of every tracked object in each one. You can start tracking something new, or stop, at any moment, and cameras can come and go.

It is meant for anyone who has to answer "where exactly is this thing, right now, in each of my video feeds": sports and broadcast graphics, warehouse and retail analytics, robotics, wildlife and lab monitoring, annotation tools.

There are two ways to say what to track. You can point: a person clicking on the picture, or a detector, says where the thing is, and tamserve takes over from there. Or you can name it: a Tracker takes a word or a phrase, finds everything that matches on every camera, and follows it.

Four words come up a lot below:

wordwhat it means here
frameone image from a video
maskthe answer for one object in one frame: a grid of True and False the size of the frame, True on every pixel that belongs to the object
prompthow you say what to track: a box around it, a click on it, a rough mask of it, or, with a Tracker, a word or a phrase
stockthe model's own code: the tracker in Meta's EdgeTAM repository, used exactly as it comes

(注:更多技术实现细节与完整 API 文档请查阅原项目 README)


作者发帖说明(HN):

I type "forklift" on a live warehouse camera, and tamserve finds and tracks both forklifts, including the one driving in. Then I add "person" without stopping it.

tamserve runs Meta's SAM 3 on live camera feeds. SAM 3's own tracker handles one recorded video at a time, runs at about 8 fps, and runs out of memory on long videos. tamserve uses SAM 3 to find objects every few frames and a lightweight tracker (EdgeTAM) to follow them in between, with one copy of each model shared across all your cameras.

On one RTX 4090:

  • Any object you name: 4x faster than SAM 3's tracker, at 92% of its accuracy * People: 16 cameras at once, 14x less GPU per frame, and slightly more accurate than SAM 3 (89.6 vs 87.8 HOTA) * Memory: flat at 3.5 GB on a 3,000 frame video, where SAM 3 runs out at frame 423

Worth a look if you're building:

  • Warehouse or factory safety (forklifts, pallets, hard hats) * Security or retail camera analytics * Home or elder care monitoring * Robotics, wildlife or lab monitoring * Annotation tools for long videos

pip install "tamserve[sam3]"

Please give me any and all feedback or edit tamserve to meet your needs, and a star helps if you find it useful!