ONE - On-device Neural Engine
Loading...
Searching...
No Matches
model_runner_caffe.py
Go to the documentation of this file.
1from common_place import *
2import caffe
3
4
5def run_caffe(model_topology, model_weight, input_path, output_path=''):
6 path = model_topology
7 path_w = model_weight
8
9 net = caffe.Net(path_w, path, caffe.TEST)
10 # TODO get 'data' parameter more universal, blobs contain other names
11 net.blobs['data'].data[...] = read_input(input_path)
12 out = net.forward()
13 all_names = [n for n in net._layer_names]
14 out = out[all_names[-1]]
15 save_result(output_path, out)
16 print(out)
17
18
19if __name__ == '__main__':
20 args = regular_step()
21
22 run_caffe(args.model[0], args.model[1], args.input, args.output_path)
read_input(input_path)
save_result(output_path, output_data)
run_caffe(model_topology, model_weight, input_path, output_path='')