From 0b58b8174630c4da0bf18298c384895c3a5aef95 Mon Sep 17 00:00:00 2001 From: zhaoguochun1995 Date: Wed, 19 Oct 2022 12:31:32 +0800 Subject: [PATCH 1/3] support for parrots --- mmdet/datasets/transforms/formatting.py | 1 + mmdet/models/layers/activations.py | 2 +- mmdet/models/utils/misc.py | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/mmdet/datasets/transforms/formatting.py b/mmdet/datasets/transforms/formatting.py index 38962e58e5d..8390602aef7 100644 --- a/mmdet/datasets/transforms/formatting.py +++ b/mmdet/datasets/transforms/formatting.py @@ -91,6 +91,7 @@ def transform(self, results: dict) -> dict: else: instance_data[self.mapping_table[key]] = results[key] else: + #import pdb;pdb.set_trace() if 'gt_ignore_flags' in results: instance_data[self.mapping_table[key]] = to_tensor( results[key][valid_idx]) diff --git a/mmdet/models/layers/activations.py b/mmdet/models/layers/activations.py index 9e73ef42180..4a8a9bf0b2d 100644 --- a/mmdet/models/layers/activations.py +++ b/mmdet/models/layers/activations.py @@ -5,7 +5,7 @@ from mmdet.registry import MODELS -if digit_version(torch.__version__) >= digit_version('1.7.0'): +if 'parrots' != torch.__version__ and digit_version(torch.__version__) >= digit_version('1.7.0'): from torch.nn import SiLU else: diff --git a/mmdet/models/utils/misc.py b/mmdet/models/utils/misc.py index 7965531de8d..a3696b70a66 100644 --- a/mmdet/models/utils/misc.py +++ b/mmdet/models/utils/misc.py @@ -539,7 +539,7 @@ def get_box_tensor(boxes: Union[Tensor, BaseBoxes]) -> Tensor: _torch_version_div_indexing = ( - 'parrots' not in torch.__version__ + 'parrots' != torch.__version__ and digit_version(torch.__version__) >= digit_version('1.8')) From 5e442610842df190dab8a0ba6966125dfb0afb7f Mon Sep 17 00:00:00 2001 From: zhaoguochun1995 Date: Thu, 27 Oct 2022 22:11:15 +0800 Subject: [PATCH 2/3] optimize for parrots --- mmdet/datasets/transforms/formatting.py | 1 - 1 file changed, 1 deletion(-) diff --git a/mmdet/datasets/transforms/formatting.py b/mmdet/datasets/transforms/formatting.py index 8390602aef7..38962e58e5d 100644 --- a/mmdet/datasets/transforms/formatting.py +++ b/mmdet/datasets/transforms/formatting.py @@ -91,7 +91,6 @@ def transform(self, results: dict) -> dict: else: instance_data[self.mapping_table[key]] = results[key] else: - #import pdb;pdb.set_trace() if 'gt_ignore_flags' in results: instance_data[self.mapping_table[key]] = to_tensor( results[key][valid_idx]) From 311b9800cc416c7fa8106f0fd4cd3a1778c6668f Mon Sep 17 00:00:00 2001 From: zhaoguochun1995 Date: Thu, 3 Nov 2022 10:27:32 +0800 Subject: [PATCH 3/3] fix no need change --- mmdet/models/layers/activations.py | 2 +- mmdet/models/utils/misc.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/mmdet/models/layers/activations.py b/mmdet/models/layers/activations.py index 4a8a9bf0b2d..9e73ef42180 100644 --- a/mmdet/models/layers/activations.py +++ b/mmdet/models/layers/activations.py @@ -5,7 +5,7 @@ from mmdet.registry import MODELS -if 'parrots' != torch.__version__ and digit_version(torch.__version__) >= digit_version('1.7.0'): +if digit_version(torch.__version__) >= digit_version('1.7.0'): from torch.nn import SiLU else: diff --git a/mmdet/models/utils/misc.py b/mmdet/models/utils/misc.py index a3696b70a66..7965531de8d 100644 --- a/mmdet/models/utils/misc.py +++ b/mmdet/models/utils/misc.py @@ -539,7 +539,7 @@ def get_box_tensor(boxes: Union[Tensor, BaseBoxes]) -> Tensor: _torch_version_div_indexing = ( - 'parrots' != torch.__version__ + 'parrots' not in torch.__version__ and digit_version(torch.__version__) >= digit_version('1.8'))