ONE - On-device Neural Engine
Loading...
Searching...
No Matches
model_runner_caffe.py
Go to the documentation of this file.
1
from
common_place
import
*
2
import
caffe
3
4
5
def
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
19
if
__name__ ==
'__main__'
:
20
args =
regular_step
()
21
22
run_caffe
(args.model[0], args.model[1], args.input, args.output_path)
common_place.regular_step
regular_step()
Definition
common_place.py:6
common_place.read_input
read_input(input_path)
Definition
common_place.py:64
common_place.save_result
save_result(output_path, output_data)
Definition
common_place.py:50
model_runner_caffe.run_caffe
run_caffe(model_topology, model_weight, input_path, output_path='')
Definition
model_runner_caffe.py:5
compiler
nnc
utils
model_runner
model_runner_caffe.py
Generated by
1.9.8