Skip to content

Commit

Permalink
[Fix] Set default out_type in CAM visualization. (open-mmlab#1586)
Browse files Browse the repository at this point in the history
  • Loading branch information
Ezra-Yu authored May 24, 2023
1 parent a779c8c commit 9bb692e
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion tools/visualization/vis_cam.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,8 @@ def get_default_traget_layers(model, args):
num_extra_tokens = args.num_extra_tokens or getattr(
model.backbone, 'num_extra_tokens', 1)

out_type = getattr(model.backbone, 'out_type')
# models like swin have no attr 'out_type', set out_type to avg_featmap
out_type = getattr(model.backbone, 'out_type', 'avg_featmap')
if out_type == 'cls_token' or num_extra_tokens > 0:
# Assume the backbone feature is class token.
name, layer = norm_layers[-3]
Expand Down

0 comments on commit 9bb692e

Please sign in to comment.