open-mmlab / mmdetection

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

The conversion overhead here is not negligible and it will slow down training. How about moving this to the data pipeline? #9508

Open RangiLyu opened 1 year ago

RangiLyu commented 1 year ago
    The conversion overhead here is not negligible and it will slow down training. How about moving this to the data pipeline?

_Originally posted by @tascj in https://github.com/open-mmlab/mmdetection/pull/9494#discussion_r1051396341_

RangiLyu commented 1 year ago

We are considering moving mask.to_tesnor to PackDetInputs. But this modification is related to all instance segmentation methods. We will open another PR for the refactoring.

tascj commented 1 year ago

Great. I tried mask.to_tesnor in PackDetInputs and it saved me 0.1x s/iter at batch size 32.

There's one related problem. You are using ndarray to store masks in BitmapMasks, which could be slow (long data_time) when used together with DataLoader. torch.Tensor with DataLoader does not have that problem. You can speed up Mask R-CNN training a bit if using torch.Tensor in BitmapMasks. It would be nice to have that in mmdet 3.x.

RangiLyu commented 1 year ago

Great! Thanks for your suggestion! We will consider this feature in the refactoring.