Remove unused variables (#8511)

Co-authored-by: Glenn Jocher <glenn.jocher@ultralytics.com>
This commit is contained in:
Kayzwer 2024-03-01 19:21:30 +08:00 committed by GitHub
parent 3c6b9b6688
commit 5e14db849b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1028,13 +1028,13 @@ def feature_visualization(x, module_type, stage, n=32, save_dir=Path("runs/detec
for m in ["Detect", "Pose", "Segment"]: for m in ["Detect", "Pose", "Segment"]:
if m in module_type: if m in module_type:
return return
batch, channels, height, width = x.shape # batch, channels, height, width _, channels, height, width = x.shape # batch, channels, height, width
if height > 1 and width > 1: if height > 1 and width > 1:
f = save_dir / f"stage{stage}_{module_type.split('.')[-1]}_features.png" # filename f = save_dir / f"stage{stage}_{module_type.split('.')[-1]}_features.png" # filename
blocks = torch.chunk(x[0].cpu(), channels, dim=0) # select batch index 0, block by channels blocks = torch.chunk(x[0].cpu(), channels, dim=0) # select batch index 0, block by channels
n = min(n, channels) # number of plots n = min(n, channels) # number of plots
fig, ax = plt.subplots(math.ceil(n / 8), 8, tight_layout=True) # 8 rows x n/8 cols _, ax = plt.subplots(math.ceil(n / 8), 8, tight_layout=True) # 8 rows x n/8 cols
ax = ax.ravel() ax = ax.ravel()
plt.subplots_adjust(wspace=0.05, hspace=0.05) plt.subplots_adjust(wspace=0.05, hspace=0.05)
for i in range(n): for i in range(n):