Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

is there any way to inference in a long time video #456

Open
come105 opened this issue Nov 20, 2024 · 2 comments
Open

is there any way to inference in a long time video #456

come105 opened this issue Nov 20, 2024 · 2 comments

Comments

@come105
Copy link

come105 commented Nov 20, 2024

When doing inference in a video, you need to use
inference_state = predictor.init_state()
to initialize the state, which will load all frames of the video, and if the video is large, it will take up a lot of memory or even fail.
I don't know why it needs to load all frames, is there any way to use segmentation or other methods to do inference in a large video?

@ovalerio
Copy link

Hi @come105,

I was also having also issues when using a large video. You can try using smaller video chunks and feed that to the model. Another option is to offload the video to the CPU. I understand that takes a bit longer but it is a good workaround if you are running out of GPU memory.

inference_state = predictor.init_state(video_path=video_dir, offload_video_to_cpu=True)

The init_state method has other few flags that you can play with.

@heyoeyo
Copy link

heyoeyo commented Nov 20, 2024

It's possible to avoid loading the frames into memory, but requires some (small) code changes. With some other changes (to avoid caching results per-frame), you can keep the VRAM use under 2GB for any video length. There's more info in issue #264.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants