mirror of
https://github.com/THU-MIG/yolov10.git
synced 2025-05-23 21:44:22 +08:00
Remove unused variables (#8511)
Co-authored-by: Glenn Jocher <glenn.jocher@ultralytics.com>
This commit is contained in:
parent
3c6b9b6688
commit
5e14db849b
@ -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):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user