From 088719988051999fc2f4efd9cdec05c0bd93593a Mon Sep 17 00:00:00 2001 From: Francesco Gatti Date: Tue, 18 Jul 2017 08:45:03 +0200 Subject: [PATCH] caffe wgex fix --- tests/caffe_weights_exporter.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tests/caffe_weights_exporter.py b/tests/caffe_weights_exporter.py index e532c5a..747457e 100644 --- a/tests/caffe_weights_exporter.py +++ b/tests/caffe_weights_exporter.py @@ -18,6 +18,8 @@ if __name__ == '__main__': args = parser.parse_args() + if not os.path.exists(args.output): + os.makedirs(args.output) print "\n\n ====== NET LOADED ====== " net = caffe.Net(args.model, args.weights, caffe.TEST) @@ -26,8 +28,12 @@ if __name__ == '__main__': for i in xrange(n_lay): key = net.params.keys()[i] print "Layer", key - print " type: ", net.layer_dict[key].type + t = net.layer_dict[key].type + print " type: ", t w = net.params[key][0].data b = net.params[key][1].data print " weights shape:", np.shape(w) print " bias shape:", np.shape(b) + + w.tofile(args.output + "/" + t + str(i) + ".bin", format="f") + b.tofile(args.output + "/" + t + str(i) + ".bias.bin", format="f")