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

Running on GPU/TPU #11

Open
niccolopetti opened this issue Jan 18, 2021 · 4 comments
Open

Running on GPU/TPU #11

niccolopetti opened this issue Jan 18, 2021 · 4 comments

Comments

@niccolopetti
Copy link
Contributor

Hi, thanks for the effort you have put into this project,
I've been using the script but it takes the cpu usage to 100% and takes quite some time to process videos lasting a couple of hours,
Are there any chances we could use our GPUs/TPUs to improve the performace?

@morrolinux
Copy link
Owner

morrolinux commented Jan 18, 2021 via email

@niccolopetti
Copy link
Contributor Author

Yes I have a GTX1050 with cuda and cudnn on ubuntu 20.10,
the slowest part is in the Cut and Merge function, that can take the CPU usage to 100% for long periods of time

niccolo@VivobookPro:/media/niccolo/DATA/simple-ehm$ python3 simple_ehm-runnable.py video.mp4 
analyzing track...
100%|█████████████████████████▉| 32968000/33000000 [00:25<00:00, 1300154.62it/s]CUT and MERGE: running 6 ffmpeg simultaneous instances.
33008000it [00:40, 1300154.62it/s]                                              
 11%|████▉                                      | 10/88 [00:20<04:34,  3.51s/it]
 12%|█████▍                                     | 11/88 [00:24<04:37,  3.60s/it]

 25%|██████████▊                                | 22/88 [01:36<05:01,  4.57s/it

@morrolinux
Copy link
Owner

So the issue is not tensorflow but rather ffmpeg being slow to encode on the CPU. Yes we can GPU-accelerate that, it's doable, but different APIs are provided for different cards (Intel/AMD/Nvidia) and making a universal kind of solution like an --enable-gpu flag on launch would need a lot of checks and modification to the current pipeline, perhaps even better by using ffmpeg python API instead of opening Popen processes.
It's a lot of boring work which I'd be willing to do if I personally needed that and I had the spare time to.
But I'm not so sure right now I can promise you that. Anyways PRs are always welcome

@niccolopetti
Copy link
Contributor Author

Thanks for the answer, I am glad to know that it is doable and once I'll have more spare time to dedicate to it I'll try to do it and make a Pr if I succeed,
any help from the community is welcome

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

2 participants