r/computervision • • 18d ago

Showcase I built tamserve: one GPU tracks objects on many live cameras with a single copy of SAM 2 / EdgeTAM (open source)

My great-grandmother had Alzheimer's, and earlier this year I co-founded Memoria to build an in-home camera that watches an older adult for falls, bad nights and wandering, and alerts the family. That means following every person on every camera, all day. EdgeTAM, from Meta's SAM 2 family, tracked people best, but its code was written for editing one recorded video: a separate copy of the model per camera, and memory that grows about 12 MB every frame. For something families pay for monthly, that didn't work, so I built tamserve.

It does for video tracking what vLLM does for chat: one copy of the model, and every object on every camera goes through it as one batch. On one RTX 4090 with EdgeTAM:

  • 64 cameras in 5.7 GB of GPU memory (321 frames/s between them). The original needs a copy of the model per camera, and 32 don't fit in 24 GB.
  • Memory that doesn't grow: 0.28 GB for an object at frame 800, against 9.8 GB for the original.
  • Faster: 219 vs 177 frames/s at 1 camera and 323 vs 280 at 8, against the original compiled and run as one process per camera.
  • Live: six 720p cameras with nine objects, every camera at a full 30 frames/s (the video above).
  • Same masks: 0.8685 vs 0.8686 on DAVIS 2017, and bit for bit on one camera with exact=True.

It also starts new objects on any frame, reconnects dropped cameras, and spreads cameras over several GPUs or machines. It runs EdgeTAM and all four SAM 2.1 sizes; with SAM 2.1 it saves memory but isn't faster, because that model keeps the GPU busy on its own.

pip install tamserve, or try it in Colab on a free T4. Apache-2.0.

If you find it useful, a star on GitHub helps other people find it. And if you're running tracking on live video, I'd love to hear what breaks.

Totally open source and free to use!

102 Upvotes

8 comments sorted by

2

u/Most-Vehicle-7825 17d ago

Which framerate do you need for EdgeTam? Do we need a good overlap between consecutive frames, or could it also e.g. track a walking person if we only get 1FPS?

1

u/Chunkymunkey642069 17d ago

So in practice, I found edgeTAM to do person tracking really well even at about 3 fps! Its accuracy does not degrade beyond 0.01 on the DAVIS benchmark and on our own product we almost never lost our person of interest.

1

u/Chunkymunkey642069 17d ago

Unfortunately didn’t measure at 1 fps because tamserve could support 3 fps comfortably

1

u/frgfm 17d ago

Thanks for sharing! Doing for tracking what vLLM did for chat is a neat way to put it, and memory that stops growing is the real win for live feeds. What happens when one camera stutters on a weak connection and you get gaps of a few seconds? Does that track's memory go stale and drift, or do you re-detect and start it fresh?

1

u/Chunkymunkey642069 17d ago

Thanks! Neither really.

While a camera is stalled it just isn't in the batch, so its tracks sit frozen. Nothing gets written to memory during the gap, so there's nothing to go stale, and the other cameras carry on at full speed.

When frames come back, the model finds the object by matching its appearance against memory (the frame you prompted on plus the last 6 frames it actually saw). There's no motion model, so it doesn't matter how far the object moved, only that it's still in view and looks roughly the same. If it left during the gap you get an empty mask. If there's a lookalike nearby it can jump to that, same as the underlying model would.

tamserve doesn't re-detect by itself since there's no detector in it. If you have one (or a person clicking), prompting the same object again replaces its memory and starts it fresh. On a real disconnect the router reconnects with backoff, keeps the objects, and sends you disconnected/reconnected events, so you can choose to re-prompt after a long outage.

I haven't benchmarked multi-second gaps specifically, so no number yet. At my startup we ran EdgeTAM at 3 fps though, so big jumps between frames are normal for it.