From 8b8cf9e5cc3e4fa3ee7eb35cca685a399506d4a2 Mon Sep 17 00:00:00 2001 From: sunjiahao1999 <578431509@qq.com> Date: Wed, 15 Feb 2023 16:11:08 +0800 Subject: [PATCH] add comments --- mmdet3d/datasets/transforms/formating.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/mmdet3d/datasets/transforms/formating.py b/mmdet3d/datasets/transforms/formating.py index 1e1bce693..87661f7d9 100644 --- a/mmdet3d/datasets/transforms/formating.py +++ b/mmdet3d/datasets/transforms/formating.py @@ -155,6 +155,10 @@ def pack_single_results(self, results: dict) -> dict: img = results['img'] if len(img.shape) < 3: img = np.expand_dims(img, -1) + # To improve the computational speed by by 3-5 times, apply: + # `torch.permute()` rather than `np.transpose()`. + # Refer to https://github.com/open-mmlab/mmdetection/pull/9533 + # for more details results['img'] = to_tensor(img).permute(2, 0, 1).contiguous() for key in [