learn caffe 1

本文详细介绍了如何使用Caffe框架加载预训练的深度学习模型,并展示了模型中各层的结构与参数形状,适用于理解模型结构及进行迁移学习。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

load Net

caffe.set_mode_cpu()

model_def = 'deploy.prototxt'
model_weights ='bvlc.caffemodel'
net = caffe.Net(model_def,      # defines the structure of the model
                model_weights,  # contains the trained weights
                caffe.TEST)     # use test mode 

net.blobs

Each layer

for layer_name,blob in net.blobs.items():
    print(layer_name+"\t"+str(blob.data.shape))

data    (5, 3, 227, 227)
conv1   (5, 96, 55, 55)
pool1   (5, 96, 27, 27)
norm1   (5, 96, 27, 27)
conv2   (5, 256, 27, 27)
pool2   (5, 256, 13, 13)
norm2   (5, 256, 13, 13)
conv3   (5, 384, 13, 13)
conv4   (5, 384, 13, 13)
conv5   (5, 256, 13, 13)
pool5   (5, 256, 6, 6)
fc6 (5, 4096)
fc7 (5, 4096)
fc8 (5, 1000)
prob    (5, 1000)

net.params



for layer_name,param in net.params.items():
    print(layer_name,'\t',param[0].data.shape,param[1].data.shape)

conv1    (96, 3, 11, 11) (96,)
conv2    (256, 48, 5, 5) (256,)
conv3    (384, 256, 3, 3) (384,)
conv4    (384, 192, 3, 3) (384,)
conv5    (256, 192, 3, 3) (256,)
fc6      (4096, 9216) (4096,)
fc7      (4096, 4096) (4096,)
fc8      (1000, 4096) (1000,)
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值