提交 9147e53a 编写于 作者: S SunAhong1993

only develop caffe.proto

上级 1804f0c8
......@@ -49,7 +49,7 @@ def arg_parser():
"--caffe_proto",
"-c",
type=_text_type,
default='./x2paddle/decoder/caffe_pb2.py',
default=None,
help="the .py file compiled by caffe proto file of caffe model")
parser.add_argument("--version",
"-v",
......@@ -91,10 +91,6 @@ def tf2paddle(model_path, save_dir):
def caffe2paddle(proto, weight, save_dir, caffe_proto):
import os
if caffe_proto is not None and not os.path.isfile(caffe_proto):
print("The .py file compiled by caffe.proto is not exist.")
return
from x2paddle.decoder.caffe_decoder import CaffeDecoder
from x2paddle.op_mapper.caffe_op_mapper import CaffeOpMapper
......
......@@ -146,6 +146,11 @@ class CaffeDecoder(object):
def __init__(self, proto_path, model_path, caffe_proto):
self.proto_path = proto_path
self.model_path = model_path
if caffe_proto is None:
caffe_proto = './x2paddle/decoder/caffe_pb2.py'
if caffe_proto is not None and not os.path.isfile(caffe_proto):
raise Exception(
"The .py file compiled by caffe.proto is not exist.")
self.resolver = CaffeResolver(caffe_proto=caffe_proto)
self.net = self.resolver.NetParameter()
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册