未验证 提交 e8112a80 编写于 作者: J Jason 提交者: GitHub

Merge pull request #113 from SunAhong1993/develop

check protobuf
......@@ -122,16 +122,10 @@ def caffe2paddle(proto, weight, save_dir, caffe_proto):
from x2paddle.decoder.caffe_decoder import CaffeDecoder
from x2paddle.op_mapper.caffe_op_mapper import CaffeOpMapper
from x2paddle.optimizer.caffe_optimizer import CaffeOptimizer
s = sys.version
if s.startswith('2'):
import commands
pb_version = commands.getstatusoutput('protoc --version')[1]
else:
import subprocess
pb_version = subprocess.getstatusoutput('protoc --version')[1]
ver_str = pb_version.split(' ')[-1].replace('.', '')
ver_int = int(ver_str)
assert ver_int >= 360, 'The version of protobuf must be larger than 3.6.0!'
import google.protobuf as gpb
ver_str = gpb.__version__.replace('.', '')
ver_int = int(ver_str[0:2])
assert ver_int >= 36, 'The version of protobuf must be larger than 3.6.0!'
print("Now translating model from caffe to paddle.")
model = CaffeDecoder(proto, weight, caffe_proto)
mapper = CaffeOpMapper(model)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册