z-x-yang / Segment-and-Track-Anything

An open-source project dedicated to tracking and segmenting any objects in videos, either automatically or interactively. The primary algorithms utilized include the Segment Anything Model (SAM) for key-frame segmentation and Associating Objects with Transformers (AOT) for efficient tracking and propagation purposes.
GNU Affero General Public License v3.0
2.84k stars 341 forks source link

Cuda out of memory for very long videos #61

Closed Davidyao99 closed 1 year ago

Davidyao99 commented 1 year ago

Does the gpu memory usage increase linearly with video duration? Is there a way to prevent long-term memory from accumulating indefinitely? I am trying to run this on a 20 minutes long video. I tried adjusting the "max_len_long_term" but it seems like GPU memory is still being increasingly consumed as the video progresses. Thank you!

LiNO3Dy commented 1 year ago

Thank you for your question. Adjusting "max_len_long_term" should allow you to run longer videos without cuda out of memory. If you have adjusted the "max_len_long_term" parameter, you may need to reinitialize your model to take the new value into account.