model=models.segmentation.fcn_resnet50(pretrained=True)
data=torch.ones(1,3,512,512)
#summary(model,(3,512,512),1,'cpu')#查看网络结构chan,w,h
#torch.onnx.export(model, data, 'name.onnx',verbose=True)
model=model.backbone
print(model)
model = nn.Sequential(*list(model.children())[:6]) # 移除最后两个模块(卷积层)
# # 获取最后一个卷积层的输出特征数量
print(model)
#model=models.maxvit_t(weights=MaxVit_T_Weights.IMAGENET1K_V1)
out=model(data)
print(out.shape)
Sequential(
(0): Conv2d(3, 64, kernel_size=(7, 7), stride=(2, 2), padding=(3, 3), bias=False)
(1): BatchNorm2d(64, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
(2): ReLU(inplace=True)
(3): MaxPool2d(kernel_size=3, stride=2, padding=1, dilation=1, ceil_mode=False)
(4): Sequential(
(0): Bottleneck(
(conv1): Conv2d(64, 64, kernel_size=(1, 1), stride=(1, 1), bias=Fals
09-22
158
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
04-14
1万+
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
01-01
1297
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
03-02
3559
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
“相关推荐”对你有帮助么?
-
非常没帮助
-
没帮助
-
一般
-
有帮助
-
非常有帮助
提交