import models
from torchsummary import summary

model = models.resnet50(pretrained=False, num_classes=7, scale=1)
print(model)
summary(model, (3, 640, 640))

使用torchsummay模块,pip install torchsummary

summayr使用方法,加入模型,以及模型输入tensor的形状即可,结尾会给出模型的权重大小,反向传播所需内存大小

使用Print同样可以直接打印模型结构,两者各有优劣。

相关文章:

  • 2021-05-21
  • 2021-09-03
  • 2021-11-24
  • 2021-11-28
  • 2021-12-06
  • 2022-01-02
  • 2022-12-23
  • 2022-03-04
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-09
  • 2022-12-23
  • 2021-06-24
相关资源
相似解决方案