首页 Paddle框架 帖子详情
paddle 如何逐层打印特征图的尺寸?
收藏
快速回复
Paddle框架 问答深度学习模型训练 1931 11
paddle 如何逐层打印特征图的尺寸?
收藏
快速回复
Paddle框架 问答深度学习模型训练 1931 11

2.0后用Sequential太方便了,但不能逐层打印特征图了。

0
收藏
回复
全部评论(11)
时间顺序
austinleaven
#2 回复于2020-10

2.0还没有使用555

0
回复
暮光の灵
#3 回复于2020-10

动态图无所畏惧

0
回复
Saxon
#4 回复于2020-10

试试paddle.summary

或者

model = paddle.Model(...)

model.summary(...)

0
回复
AIStudio810258
#5 回复于2020-10
Saxon #4
试试paddle.summary 或者 model = paddle.Model(...) model.summary(...)

谢谢大侠!

这就去试试~

0
回复
AIStudio810258
#6 回复于2020-10
Saxon #4
试试paddle.summary 或者 model = paddle.Model(...) model.summary(...)

BEAUTIFUL!

 

--------------------------------------------------------------------------------
Layer (type) Input Shape Output Shape Param #
================================================================================
Conv2d-11 [1, 1, 28, 28] [1, 64, 14, 14] 3,200
BatchNorm2d-10 [1, 64, 14, 14] [1, 64, 14, 14] 256
ReLU-6 [1, 64, 14, 14] [1, 64, 14, 14] 0
Pool2D-3 [1, 64, 14, 14] [1, 64, 7, 7] 0
Conv2d-12 [1, 64, 7, 7] [1, 64, 7, 7] 36,928
BatchNorm2d-11 [1, 64, 7, 7] [1, 64, 7, 7] 256
ReLU-7 [1, 64, 7, 7] [1, 64, 7, 7] 0
Conv2d-13 [1, 64, 7, 7] [1, 64, 7, 7] 36,928
BatchNorm2d-12 [1, 64, 7, 7] [1, 64, 7, 7] 256
Residual-5 [1, 64, 7, 7] [1, 64, 7, 7] 0
Conv2d-14 [1, 64, 7, 7] [1, 64, 7, 7] 36,928
BatchNorm2d-13 [1, 64, 7, 7] [1, 64, 7, 7] 256
ReLU-8 [1, 64, 7, 7] [1, 64, 7, 7] 0
Conv2d-15 [1, 64, 7, 7] [1, 64, 7, 7] 36,928
BatchNorm2d-14 [1, 64, 7, 7] [1, 64, 7, 7] 256
Residual-6 [1, 64, 7, 7] [1, 64, 7, 7] 0
ResnetBlock-3 [1, 64, 7, 7] [1, 64, 7, 7] 0
Conv2d-16 [1, 64, 7, 7] [1, 128, 4, 4] 73,856
BatchNorm2d-15 [1, 128, 4, 4] [1, 128, 4, 4] 512
ReLU-9 [1, 128, 4, 4] [1, 128, 4, 4] 0
Conv2d-17 [1, 128, 4, 4] [1, 128, 4, 4] 147,584
BatchNorm2d-16 [1, 128, 4, 4] [1, 128, 4, 4] 512
Conv2d-18 [1, 64, 7, 7] [1, 128, 4, 4] 8,320
Residual-7 [1, 64, 7, 7] [1, 128, 4, 4] 0
Conv2d-19 [1, 128, 4, 4] [1, 128, 4, 4] 147,584
BatchNorm2d-17 [1, 128, 4, 4] [1, 128, 4, 4] 512
ReLU-10 [1, 128, 4, 4] [1, 128, 4, 4] 0
Conv2d-20 [1, 128, 4, 4] [1, 128, 4, 4] 147,584
BatchNorm2d-18 [1, 128, 4, 4] [1, 128, 4, 4] 512
Residual-8 [1, 128, 4, 4] [1, 128, 4, 4] 0
ResnetBlock-4 [1, 64, 7, 7] [1, 128, 4, 4] 0
Pool2D-4 [1, 128, 4, 4] [1, 128, 1, 1] 0
Linear-2 [1, 128] [1, 10] 1,290
Softmax-2 [1, 10] [1, 10] 0
================================================================================
Total params: 680,458
Trainable params: 677,130
Non-trainable params: 3,328
--------------------------------------------------------------------------------
Input size (MB): 0.00
Forward/backward pass size (MB): 0.84
Params size (MB): 2.60
Estimated Total Size (MB): 3.44
--------------------------------------------------------------------------------

{'total_params': 680458, 'trainable_params': 677130}

0
回复
thinc
#7 回复于2020-10
BEAUTIFUL!   -------------------------------------------------------------------------------- Layer (type) Input Shape Output Shape Param # ================================================================================ Conv2d-11 [1, 1, 28, 28] [1, 64, 14, 14] 3,200 BatchNorm2d-10 [1, 64, 14, 14] [1, 64, 14, 14] 256 ReLU-6 [1, 64, 14, 14] [1, 64, 14, 14] 0 Pool2D-3 [1, 64, 14, 14] [1, 64, 7, 7] 0 Conv2d-12 [1, 64, 7, 7] [1, 64, 7, 7] 36,928 BatchNorm2d-11 [1, 64, 7, 7] [1, 64, 7, 7] 256 ReLU-7 [1, 64, 7, 7] [1, 64, 7, 7] 0 Conv2d-13 [1, 64, 7, 7] [1, 64, 7, 7] 36,928 BatchNorm2d-12 [1, 64, 7, 7] [1, 64, 7, 7] 256 Residual-5 [1, 64, 7, 7] [1, 64, 7, 7] 0 Conv2d-14 [1, 64, 7, 7] [1, 64, 7, 7] 36,928 BatchNorm2d-13 [1, 64, 7, 7] [1, 64, 7, 7] 256 ReLU-8 [1, 64, 7, 7] [1, 64, 7, 7] 0 Conv2d-15 [1, 64, 7, 7] [1, 64, 7, 7] 36,928 BatchNorm2d-14 [1, 64, 7, 7] [1, 64, 7, 7] 256 Residual-6 [1, 64, 7, 7] [1, 64, 7, 7] 0 ResnetBlock-3 [1, 64, 7, 7] [1, 64, 7, 7] 0 Conv2d-16 [1, 64, 7, 7] [1, 128, 4, 4] 73,856 BatchNorm2d-15 [1, 128, 4, 4] [1, 128, 4, 4] 512 ReLU-9 [1, 128, 4, 4] [1, 128, 4, 4] 0 Conv2d-17 [1, 128, 4, 4] [1, 128, 4, 4] 147,584 BatchNorm2d-16 [1, 128, 4, 4] [1, 128, 4, 4] 512 Conv2d-18 [1, 64, 7, 7] [1, 128, 4, 4] 8,320 Residual-7 [1, 64, 7, 7] [1, 128, 4, 4] 0 Conv2d-19 [1, 128, 4, 4] [1, 128, 4, 4] 147,584 BatchNorm2d-17 [1, 128, 4, 4] [1, 128, 4, 4] 512 ReLU-10 [1, 128, 4, 4] [1, 128, 4, 4] 0 Conv2d-20 [1, 128, 4, 4] [1, 128, 4, 4] 147,584 BatchNorm2d-18 [1, 128, 4, 4] [1, 128, 4, 4] 512 Residual-8 [1, 128, 4, 4] [1, 128, 4, 4] 0 ResnetBlock-4 [1, 64, 7, 7] [1, 128, 4, 4] 0 Pool2D-4 [1, 128, 4, 4] [1, 128, 1, 1] 0 Linear-2 [1, 128] [1, 10] 1,290 Softmax-2 [1, 10] [1, 10] 0 ================================================================================ Total params: 680,458 Trainable params: 677,130 Non-trainable params: 3,328 -------------------------------------------------------------------------------- Input size (MB): 0.00 Forward/backward pass size (MB): 0.84 Params size (MB): 2.60 Estimated Total Size (MB): 3.44 -------------------------------------------------------------------------------- {'total_params': 680458, 'trainable_params': 677130}
展开

哇⊙∀⊙!酷

0
回复
AIStudio810258
#8 回复于2020-10
thinc #7
哇⊙∀⊙!酷

而且后来发祥网络权重也是可以打印滴~~

0
回复
thinc
#9 回复于2020-10
而且后来发祥网络权重也是可以打印滴~~

是用model.summary()这个方法吗

0
回复
AIStudio810258
#10 回复于2020-10
thinc #9
是用model.summary()这个方法吗

rnpt = ResNet()

param_info = paddle.summary(rnpt, (1, 28, 28), batch_size=1)

print(param_info)

0
回复
AIStudio810258
#11 回复于2020-10
thinc #9
是用model.summary()这个方法吗

只要定义模型对象就可,不需正向计算。

要输入一个初始特征图(即图片)尺寸就行了

0
回复
thinc
#12 回复于2020-10
rnpt = ResNet() param_info = paddle.summary(rnpt, (1, 28, 28), batch_size=1) print(param_info)

懂了,这就去查summary这个属性

0
回复
需求/bug反馈?一键提issue告诉我们
发现bug?如果您知道修复办法,欢迎提pr直接参与建设飞桨~
在@后输入用户全名并按空格结束,可艾特全站任一用户