open-mmlab / mmdetection

OpenMMLab Detection Toolbox and Benchmark
https://mmdetection.readthedocs.io
Apache License 2.0
29.69k stars 9.48k forks source link

Integrating Kornia batch augmentation pipeline. #5572

Open shijianjian opened 3 years ago

shijianjian commented 3 years ago

Hi mmdet maintainers,

Thanks for the repo. We are the project lead of Kornia, and thinking of the possibilities of integrating Kornia augmentation pipeline into mmdet.

From the feature-level, we can provide:

Motivation: mmdet data pipeline happened outside the PyTorch computation graph and computed on CPUs in a image-by-image manner, which might increase the deployment difficulties and time legacy whilst processing large batches. With Kornia, it is much easier to include test time image processing pipelines into the model whilst export and deployment. Also, the image preprocessing could enjoy the GPU accerlations provided by PyTorch.

Our proposal:

rbavery commented 3 years ago

Hi! I'm a newcomer to mmdetection. Just want to say that this sounds like a really useful feature.

I haven't seen many articles on benchmarks of cpu vs gpu augmentation, but this article seems to indicate that some standard gpu augmentations tend to outperform cpu augmentations for larger image inputs: https://arxiv.org/pdf/2011.09832v1.pdf

This other article tested more augmentations without kornia, finding a similar result, though some augs performed better on the cpu: https://www.loka.com/blog/gpu-image-benchmarking

If there are more comprehensive benchmarks from Kornia comparing gpu-based augs to cpu augs, that might help drive discussion about the value of supporting kornia in mmdet? Are the maintainers of mmdet interested in a PR supporting Kornia?

shijianjian commented 3 years ago

Hi @rbavery, Thanks for sharing.

Those numbers in that preprint is outdated and Kornia DDA shall be faster now. I will probably start benchmarking/testing on the following in the following weeks:

shijianjian commented 3 years ago

Please check this PR for the augmentation speed accelerated brought by Kornia.

https://github.com/kornia/kornia/pull/1459#issue-781653916

willcray commented 1 month ago

This would be particularly useful for augmentations like CachedMosaic, which is used in the RTMDet training pipeline