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
Speedup the Video Inference by Accelerating data-loading Stage #7832
Conversation
You can compare the original # post-operations in `video_demo.py` and my `video_gpuaccel_demo.py`.
model.show_result(xxx)
``` |
@chenxinfeng4 Thank you very much for your contribution. |
lint failed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can add some documents about this script in https://github.com/open-mmlab/mmdetection/blob/master/docs/en/1_exist_data_model.md
Please use pre-commit hook to fix the lint. |
@chenxinfeng4 Thanks for your very fast response. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
I'm not an expert of git. Why the PR is block? What should I do next? |
Hello @chenxinfeng4. Merging is controlled by maintainers. We will merge this pr as soon as possible. Seems the lint fails again. Please remember to fix it. Thanks for your quick response. |
* add a faster inference for video * Fix typos * modify typo * modify the numpy array to torch gpu * fix lint * add description * add documents * fix typro * fix lint * fix lint * fix lint again * fix a mistake
…mmlab#7832) * add a faster inference for video * Fix typos * modify typo * modify the numpy array to torch gpu * fix lint * add description * add documents * fix typro * fix lint * fix lint * fix lint again * fix a mistake
…mmlab#7832) * add a faster inference for video * Fix typos * modify typo * modify the numpy array to torch gpu * fix lint * add description * add documents * fix typro * fix lint * fix lint * fix lint again * fix a mistake
…mmlab#7832) * add a faster inference for video * Fix typos * modify typo * modify the numpy array to torch gpu * fix lint * add description * add documents * fix typro * fix lint * fix lint * fix lint again * fix a mistake
Motivation
The video inference was not efficient, because there are many "resize", "padding", "to rgb" and "normalize" operations in CPU workload. Besides, the 'img_metas' is calculated for every frame, which is nonefficient. The CPU workload is really high, but the speed is slow.
Modification
I transformed the video "crop", "resize", "padding", "to rgb" in ffmpeg-based video reader, which is lite and CPU friendly. The video reader can support NVIDIA-VIDEO-DECODING if possible, to save more CPU workload. And the "normalize" is done in GPU. In all, I reduced the data-loading time and CPU workload.
Result
After this modification, the CPU workload can reduced from >1000% to 180%, and slightly improve the inference frame rate. It's significant in the case that dataloading is the heaviest cost than the network evalutation, such as the yolact.