怎么查看下载的.npy模型里面的参数

根据Kevin 训练VGG教程而来


假设我们这里已经有了一个VGG16层的参数原始文件,想要打开来看一下参数设置,使用以下函数就行了,涉及到的库自行补充

测试加载进来的参数
def test_load():
    data_path = './/VGG-pretrain//vgg16.npy'  # 文件保存路径
    # 注意这个文件要到网上自行下载
    data_dict = np.load(data_path, encoding='latin1').item()
    keys = sorted(data_dict.keys())
    for key in keys:
        weights = data_dict[key][0]
        biases = data_dict[key][1]
        print('\n')
        print(key)
        print('weights shape: ', weights.shape)
        print('biases shape: ', biases.shape)

结果展示:

conv1_1

weights shape:  (3, 3, 3, 64)
biases shape:  (64,)




conv1_2
weights shape:  (3, 3, 64, 64)
biases shape:  (64,)




conv2_1
weights shape:  (3, 3, 64, 128)
biases shape:  (128,)




conv2_2
weights shape:  (3, 3, 128, 128)
biases shape:  (128,)




conv3_1
weights shape:  (3, 3, 128, 256)
biases shape:  (256,)




conv3_2
weights shape:  (3, 3, 256, 256)
biases shape:  (256,)




conv3_3
weights shape:  (3, 3, 256, 256)
biases shape:  (256,)




conv4_1
weights shape:  (3, 3, 256, 512)
biases shape:  (512,)




conv4_2
weights shape:  (3, 3, 512, 512)
biases shape:  (512,)




conv4_3
weights shape:  (3, 3, 512, 512)
biases shape:  (512,)




conv5_1
weights shape:  (3, 3, 512, 512)
biases shape:  (512,)




conv5_2
weights shape:  (3, 3, 512, 512)
biases shape:  (512,)




conv5_3
weights shape:  (3, 3, 512, 512)
biases shape:  (512,)




fc6
weights shape:  (25088, 4096)
biases shape:  (4096,)




fc7
weights shape:  (4096, 4096)
biases shape:  (4096,)




fc8
weights shape:  (4096, 1000)
biases shape:  (1000,)
  • 1
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

打赏作者

Tina姐

我就看看有没有会打赏我

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

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

打赏作者

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

抵扣说明:

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

余额充值