Open lgarithm opened 6 years ago
[i] 1 34848 shape(11,11,3,96)
[i] 2 96 shape(96)
[i] 3 614400 shape(5,5,96,256)
[i] 4 256 shape(256)
[i] 5 884736 shape(3,3,256,384)
[i] 6 384 shape(384)
[i] 7 1327104 shape(3,3,384,384)
[i] 8 384 shape(384)
[i] 9 884736 shape(3,3,384,256)
[i] 10 256 shape(256)
[i] 11 37748736 shape(9216,4096)
[i] 12 4096 shape(4096)
[i] 13 16777216 shape(4096,4096)
[i] 14 4096 shape(4096)
[i] 15 4096000 shape(4096,1000)
[i] 16 1000 shape(1000)
[i] total dim: 62378344
1 conv1_W float32 34848 (11, 11, 3, 96)
2 conv1_b float32 96 (96,)
3 conv2_W float32 307200 (5, 5, 48, 256)
4 conv2_b float32 256 (256,)
5 conv3_W float32 884736 (3, 3, 256, 384)
6 conv3_b float32 384 (384,)
7 conv4_W float32 663552 (3, 3, 192, 384)
8 conv4_b float32 384 (384,)
9 fc6_W float32 37748736 (9216, 4096)
10 fc6_b float32 4096 (4096,)
11 fc7_W float32 16777216 (4096, 4096)
12 fc7_b float32 4096 (4096,)
#!/usr/bin/env python3
#
# inspect nbvlc_alexnet.npy
#
from functools import reduce
import operator as op
import numpy as np
layers = np.load(open("bvlc_alexnet.npy", "rb"), encoding="latin1").item()
layer_names = ['conv%d' % i for i in range(1, 5)] + ['fc%d' % i for i in range(6, 8)]
def list_params():
for name in layer_names:
w, b = layers[name]
yield '%s_W' % name, w
yield '%s_b' % name, b
for idx, (name, p) in enumerate(list_params()):
dim = reduce(op.mul, p.shape, 1)
print('%-8d %-24s %-24s %-16d %s' % (idx + 1, name, p.dtype, dim, p.shape))