Skip to content

Commit 1730b79

Browse files
author
Evgeny Tsykunov
authored
Fix: ActivationMapHook process backbone instead of neck output (#2145)
* ActivationMapHook process backbone instead of neck output * timm version fix
1 parent 7414eab commit 1730b79

File tree

5 files changed

+11
-7
lines changed

5 files changed

+11
-7
lines changed

otx/algorithms/detection/adapters/mmdet/models/detectors/custom_maskrcnn_detector.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,14 +99,16 @@ def load_state_dict_pre_hook(model, model_classes, chkpt_classes, chkpt_dict, pr
9999
def custom_mask_rcnn__simple_test(ctx, self, img, img_metas, proposals=None, **kwargs):
100100
"""Function for custom_mask_rcnn__simple_test."""
101101
assert self.with_bbox, "Bbox head must be implemented."
102-
x = self.extract_feat(img)
102+
x = backbone_out = self.backbone(img)
103+
if self.with_neck:
104+
x = self.neck(x)
103105
if proposals is None:
104106
proposals, _ = self.rpn_head.simple_test_rpn(x, img_metas)
105107
out = self.roi_head.simple_test(x, proposals, img_metas, rescale=False)
106108

107109
if ctx.cfg["dump_features"]:
108110
feature_vector = FeatureVectorHook.func(x)
109-
saliency_map = ActivationMapHook.func(x[-1])
111+
saliency_map = ActivationMapHook.func(backbone_out)
110112
return (*out, feature_vector, saliency_map)
111113

112114
return out

otx/algorithms/detection/adapters/mmdet/models/detectors/custom_maskrcnn_tile_optimized.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -309,14 +309,16 @@ def custom_mask_rcnn__simple_test(ctx, self, img, img_metas, proposals=None):
309309
assert self.with_bbox, "Bbox head must be implemented."
310310
tile_prob = self.tile_classifier.simple_test(img)
311311

312-
x = self.extract_feat(img)
312+
x = backbone_out = self.backbone(img)
313+
if self.with_neck:
314+
x = self.neck(x)
313315
if proposals is None:
314316
proposals, _ = self.rpn_head.simple_test_rpn(x, img_metas)
315317
out = self.roi_head.simple_test(x, proposals, img_metas, rescale=False)
316318

317319
if ctx.cfg["dump_features"]:
318320
feature_vector = FeatureVectorHook.func(x)
319-
saliency_map = ActivationMapHook.func(x[-1])
321+
saliency_map = ActivationMapHook.func(backbone_out)
320322
return (*out, tile_prob, feature_vector, saliency_map)
321323

322324
return (*out, tile_prob)

requirements/classification.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22
# Classification Requirements.
33
mmcv-full==1.7.0
44
mmcls==0.25.0
5-
timm
5+
timm==0.6.12
66
mmdeploy==0.14.0
77
pytorchcv

requirements/detection.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@ mmcv-full==1.7.0
44
mmdet==2.28.1
55
pytorchcv
66
mmcls==0.25.0
7-
timm
7+
timm==0.6.12
88
mmdeploy==0.14.0
99
scikit-image

requirements/segmentation.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@ mmcv-full==1.7.0
44
mmsegmentation==0.30.0
55
scikit-image
66
mmdeploy==0.14.0
7-
timm
7+
timm==0.6.12
88
pytorchcv

0 commit comments

Comments
 (0)