yangchris11 / samurai

Official repository of "SAMURAI: Adapting Segment Anything Model for Zero-Shot Visual Tracking with Motion-Aware Memory"
https://yangchris11.github.io/samurai/
Apache License 2.0
5.42k stars 310 forks source link

Is there a memory leak? #41

Closed richieling closed 1 day ago

richieling commented 3 days ago

Hello, I tried to run the demo.py on a custom video of approx 5 mins long. I noticed my PC RAM memory usage spiked up to >100GB, which is quite unusual. Is there a possibility of a memory leak somewhere?

I have tried on both my desktop (2080 Ti) and DGX A100 machines.

What is the expected RAM and GPU usage for running this model for inference only?

Thanks!

MeharRamzan commented 3 days ago

@richieling The error occurs due to storing all video frames in a single list, which leads to memory overflow. Modifying the storage type will resolve this issue. image

yangchris11 commented 3 days ago

See https://github.com/facebookresearch/sam2/issues/264 for more details on inference long videos.