提交 bbb52e70 编写于 作者: W wanglong03

fix code style problems

上级 774f40dd
...@@ -49,6 +49,7 @@ def convert(def_path, caffemodel_path, data_output_path, code_output_path, ...@@ -49,6 +49,7 @@ def convert(def_path, caffemodel_path, data_output_path, code_output_path,
return 0 return 0
def main(): def main():
""" main """ main
""" """
...@@ -65,7 +66,7 @@ def main(): ...@@ -65,7 +66,7 @@ def main():
help='The phase to convert: test (default) or train') help='The phase to convert: test (default) or train')
args = parser.parse_args() args = parser.parse_args()
validate_arguments(args) validate_arguments(args)
convert(args.def_path, args.caffemodel, args.data_output_path, return convert(args.def_path, args.caffemodel, args.data_output_path,
args.code_output_path, args.phase) args.code_output_path, args.phase)
......
...@@ -13,6 +13,7 @@ import numpy as np ...@@ -13,6 +13,7 @@ import numpy as np
import paddle.v2 as paddle import paddle.v2 as paddle
import paddle.v2.fluid as fluid import paddle.v2.fluid as fluid
def load_data(imgfile, shape): def load_data(imgfile, shape):
h, w = shape[1:] h, w = shape[1:]
from PIL import Image from PIL import Image
...@@ -35,7 +36,8 @@ def load_data(imgfile, shape): ...@@ -35,7 +36,8 @@ def load_data(imgfile, shape):
def build_model(net_file, net_name): def build_model(net_file, net_name):
print('build model with net_file[%s] and net_name[%s]' % (net_file, net_name)) print('build model with net_file[%s] and net_name[%s]' %
(net_file, net_name))
net_path = os.path.dirname(net_file) net_path = os.path.dirname(net_file)
module_name = os.path.basename(net_file).rstrip('.py') module_name = os.path.basename(net_file).rstrip('.py')
...@@ -128,12 +130,13 @@ if __name__ == "__main__": ...@@ -128,12 +130,13 @@ if __name__ == "__main__":
net_file = sys.argv[1] net_file = sys.argv[1]
weight_file = sys.argv[2] weight_file = sys.argv[2]
imgfile = sys.argv[3] imgfile = sys.argv[3]
net_name= sys.argv[4] net_name = sys.argv[4]
elif argc > 1: elif argc > 1:
print('usage:') print('usage:')
print('\tpython %s [net_file] [weight_file] [imgfile] [net_name]' % (sys.argv[0])) print('\tpython %s [net_file] [weight_file] [imgfile] [net_name]' %
print('\teg:python %s %s %s %s %s' % (sys.argv[0], (sys.argv[0]))
net_file, weight_file, imgfile, net_name)) print('\teg:python %s %s %s %s %s' % (sys.argv[0], net_file,
weight_file, imgfile, net_name))
sys.exit(1) sys.exit(1)
infer(net_file, net_name, weight_file, imgfile) infer(net_file, net_name, weight_file, imgfile)
...@@ -10,6 +10,7 @@ import numpy as np ...@@ -10,6 +10,7 @@ import numpy as np
import paddle.v2 as paddle import paddle.v2 as paddle
import paddle.v2.fluid as fluid import paddle.v2.fluid as fluid
def test_model(exe, test_program, fetch_list, test_reader, feeder): def test_model(exe, test_program, fetch_list, test_reader, feeder):
acc_set = [] acc_set = []
...@@ -79,8 +80,7 @@ if __name__ == "__main__": ...@@ -79,8 +80,7 @@ if __name__ == "__main__":
elif argc > 1: elif argc > 1:
print('usage:') print('usage:')
print('\tpython %s [net_file] [weight_file]' % (sys.argv[0])) print('\tpython %s [net_file] [weight_file]' % (sys.argv[0]))
print('\teg:python %s %s %s %s' % (sys.argv[0], print('\teg:python %s %s %s %s' % (sys.argv[0], net_file, weight_file))
net_file, weight_file))
sys.exit(1) sys.exit(1)
evaluate(net_file, weight_file) evaluate(net_file, weight_file)
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册