-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpartial.py
More file actions
23 lines (20 loc) · 692 Bytes
/
Copy pathpartial.py
File metadata and controls
23 lines (20 loc) · 692 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
from darknet import Darknet
def partial(cfgfile, weightfile, outfile, cutoff):
m = Darknet(cfgfile)
m.print_network()
m.load_weights(weightfile)
m.seen = 0
m.save_weights(outfile, cutoff)
print('save %s' % (outfile))
if __name__ == '__main__':
import sys
if len(sys.argv) == 5:
cfgfile = sys.argv[1]
weightfile = sys.argv[2]
outfile = sys.argv[3]
cutoff = int(sys.argv[4])
partial(cfgfile, weightfile, outfile, cutoff)
else:
print('Usage:')
print('python partial.py cfgfile weightfile output cutoff')
#partial('cfg/tiny-yolo-voc.cfg', 'tiny-yolo-voc.weights', 'tiny-yolo-voc.conv.15', 15)