Skip to content

Commit

Permalink
genw
Browse files Browse the repository at this point in the history
  • Loading branch information
thtrieu committed Nov 12, 2016
1 parent 84e9f4c commit 20184c1
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 6 deletions.
18 changes: 14 additions & 4 deletions genw.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,21 @@ def inc(self):
def give(self):
self.inc()
l = self.net.layers[self.i]
w = l.weights
w = list()
if l.type == 'convolutional':
w = w.transpose([3,2,0,1])
w = w.reshape([-1])
w = np.concatenate((l.biases, w))
w += [l.p['biases']]
if l.batch_norm:
w += [l.p['scale']]
w += [l.p['mean']]
w += [l.p['var']]
kernel = l.p['kernel']
kernel = kernel.transpose([3,2,0,1])
kernel = kernel.reshape([-1])
w += [kernel]
if l.type == 'connected':
w += [l.p['biases']]
w += [l.p['weights'].reshape([-1])]
w = np.concatenate(w)
self.i += 1
return np.float32(w)

Expand Down
2 changes: 0 additions & 2 deletions labels.txt
Original file line number Diff line number Diff line change
@@ -1,2 +0,0 @@
tvmonitor
pottedplant
1 change: 1 addition & 0 deletions yolo/drawer.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ def to_color(indx, base):
else:
with open('labels.txt','r') as f:
meta['labels'] = [l.strip() for l in f.readlines()]
if len(meta['labels']) == 0: meta['labels'] = labels20
if len(meta['labels']) != meta['classes']:
msg = 'labels.txt and configs/yolo-{}.cfg '
msg+= 'indicate different class number'
Expand Down

0 comments on commit 20184c1

Please sign in to comment.