提交 af9a4d45 编写于 作者: S SunAhong1993

fix the bug of infer.py

上级 2ee08d39
...@@ -59,8 +59,9 @@ def build_model(net_file, net_name): ...@@ -59,8 +59,9 @@ def build_model(net_file, net_name):
inputs_dict = MyNet.input_shapes() inputs_dict = MyNet.input_shapes()
input_name = list(inputs_dict.keys())[0] input_name = list(inputs_dict.keys())[0]
input_shape = inputs_dict[input_name] input_shape = inputs_dict[input_name]
images = fluid.layers.data( images = fluid.layers.data(name=input_name,
name=input_name, shape=input_shape, dtype='float32') shape=input_shape,
dtype='float32')
#label = fluid.layers.data(name='label', shape=[1], dtype='int64') #label = fluid.layers.data(name='label', shape=[1], dtype='int64')
net = MyNet({input_name: images}) net = MyNet({input_name: images})
...@@ -172,7 +173,7 @@ def load_model(exe, place, net_file, net_name, net_weight, debug): ...@@ -172,7 +173,7 @@ def load_model(exe, place, net_file, net_name, net_weight, debug):
def get_shape(fluid, program, name): def get_shape(fluid, program, name):
for var in program.list_vars(): for var in program.list_vars():
if var.type == 'Input': if var.name == name:
return list(var.shape[1:]) return list(var.shape[1:])
raise ValueError('not found shape for input layer[%s], ' raise ValueError('not found shape for input layer[%s], '
......
...@@ -49,7 +49,7 @@ if [[ -z $PYTHON ]];then ...@@ -49,7 +49,7 @@ if [[ -z $PYTHON ]];then
PYTHON=`which python` PYTHON=`which python`
fi fi
$PYTHON ../../convert.py \ $PYTHON ../../convert.py \
--npy_path $proto_file \ --def_path $proto_file \
--caffemodel $caffemodel_file \ --caffemodel $caffemodel_file \
--data-output-path $weight_file\ --data-output-path $weight_file\
--code-output-path $net_file --code-output-path $net_file
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册