mmdet 输出模型通道数

输出ShuffleNetV2通道数

# 查看网络通道数
from mmcls.models import ShuffleNetV1, ShuffleNetV2, MobileNetV2, MobileNetV3, EfficientNet
import torch

# m = MobileNetV3(out_indices=(3, 8, 11))
m = ShuffleNetV2(out_indices=(0,1,2,3))
# m = EfficientNet(out_indices=(0,1,2,3))
m.eval()
inputs = torch.rand(1, 3, 224, 224)
level_outputs = m(inputs)
for level_out in level_outputs:
    print(tuple(level_out.shape))
# (1, 116, 80, 80)
# (1, 232, 40, 40)
# (1, 464, 20, 20)
# (1, 1024, 20, 20)

可以看出0,1,2,3对应通道数为116,232,464,1024

输出efficientnet通道数

import torch
from mmcls.models.backbones import EfficientNet

# 创建 EfficientNet 模型
model = EfficientNet(arch='b3')

# 输入随机数据进行推断
input_data = torch.randn(1, 3, 224, 224)
outputs = model(input_data)

# 输出每个层级的形状
#for i, output in enumerate(outputs):
#    print(f"Level {i} output shape: {output.shape}")

# 逐层遍历模型的子模块,以获取所有层级的输出形状
for i, layer in enumerate(model.layers):
    input_data = layer(input_data)
    print(f"Level {i} output shape: {input_data.shape}")
'b0'
Level 0 output shape: torch.Size([1, 32, 112, 112])
Level 1 output shape: torch.Size([1, 16, 112, 112])
Level 2 output shape: torch.Size([1, 24, 56, 56])
Level 3 output shape: torch.Size([1, 40, 28, 28])
Level 4 output shape: torch.Size([1, 112, 14, 14])
Level 5 output shape: torch.Size([1, 320, 7, 7])
Level 6 output shape: torch.Size([1, 1280, 7, 7])
# 'b1'
Level 0 output shape: torch.Size([1, 32, 112, 112])
Level 1 output shape: torch.Size([1, 16, 112, 112])
Level 2 output shape: torch.Size([1, 24, 56, 56])
Level 3 output shape: torch.Size([1, 40, 28, 28])
Level 4 output shape: torch.Size([1, 112, 14, 14])
Level 5 output shape: torch.Size([1, 320, 7, 7])
Level 6 output shape: torch.Size([1, 1280, 7, 7])

'b2'
Level 0 output shape: torch.Size([1, 32, 112, 112])
Level 1 output shape: torch.Size([1, 16, 112, 112])
Level 2 output shape: torch.Size([1, 24, 56, 56])
Level 3 output shape: torch.Size([1, 48, 28, 28])
Level 4 output shape: torch.Size([1, 120, 14, 14])
Level 5 output shape: torch.Size([1, 352, 7, 7])
Level 6 output shape: torch.Size([1, 1408, 7, 7])
'b3'
Level 0 output shape: torch.Size([1, 40, 112, 112])
Level 1 output shape: torch.Size([1, 24, 112, 112])
Level 2 output shape: torch.Size([1, 32, 56, 56])
Level 3 output shape: torch.Size([1, 48, 28, 28])
Level 4 output shape: torch.Size([1, 136, 14, 14])
Level 5 output shape: torch.Size([1, 384, 7, 7])
Level 6 output shape: torch.Size([1, 1536, 7, 7])
'b4'
Level 0 output shape: torch.Size([1, 48, 112, 112])
Level 1 output shape: torch.Size([1, 24, 112, 112])
Level 2 output shape: torch.Size([1, 32, 56, 56])
Level 3 output shape: torch.Size([1, 56, 28, 28])
Level 4 output shape: torch.Size([1, 160, 14, 14])
Level 5 output shape: torch.Size([1, 448, 7, 7])
Level 6 output shape: torch.Size([1, 1792, 7, 7])
'b5'
Level 0 output shape: torch.Size([1, 48, 112, 112])
Level 1 output shape: torch.Size([1, 24, 112, 112])
Level 2 output shape: torch.Size([1, 40, 56, 56])
Level 3 output shape: torch.Size([1, 64, 28, 28])
Level 4 output shape: torch.Size([1, 176, 14, 14])
Level 5 output shape: torch.Size([1, 512, 7, 7])
Level 6 output shape: torch.Size([1, 2048, 7, 7])
'b6'
Level 0 output shape: torch.Size([1, 56, 112, 112])
Level 1 output shape: torch.Size([1, 32, 112, 112])
Level 2 output shape: torch.Size([1, 40, 56, 56])
Level 3 output shape: torch.Size([1, 72, 28, 28])
Level 4 output shape: torch.Size([1, 200, 14, 14])
Level 5 output shape: torch.Size([1, 576, 7, 7])
Level 6 output shape: torch.Size([1, 2304, 7, 7])
'b7'
Level 0 output shape: torch.Size([1, 64, 112, 112])
Level 1 output shape: torch.Size([1, 32, 112, 112])
Level 2 output shape: torch.Size([1, 48, 56, 56])
Level 3 output shape: torch.Size([1, 80, 28, 28])
Level 4 output shape: torch.Size([1, 224, 14, 14])
Level 5 output shape: torch.Size([1, 640, 7, 7])
Level 6 output shape: torch.Size([1, 2560, 7, 7])
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

壹万1w

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值