From bd1a8295fb197082f82fdd41a353ad82c71505ef Mon Sep 17 00:00:00 2001 From: tiancailin Date: Wed, 3 Jan 2024 15:07:19 +0800 Subject: [PATCH] Fix bug in issue #12457. (#12459) * Fix bug in #12457. When run 'python.exe segment/predict.py --visualize' will throw AttributeError: 'tuple' object has no attribute 'shape' * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Glenn Jocher --- utils/plots.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/utils/plots.py b/utils/plots.py index db6f94a6674d..5901ca2dbfaa 100644 --- a/utils/plots.py +++ b/utils/plots.py @@ -59,7 +59,9 @@ def feature_visualization(x, module_type, stage, n=32, save_dir=Path('runs/detec n: Maximum number of feature maps to plot save_dir: Directory to save results """ - if 'Detect' not in module_type: + if ('Detect' + not in module_type) and ('Segment' + not in module_type): # 'Detect' for Object Detect task,'Segment' for Segment task batch, channels, height, width = x.shape # batch, channels, height, width if height > 1 and width > 1: f = save_dir / f"stage{stage}_{module_type.split('.')[-1]}_features.png" # filename