我正在尝试使用DeepLab转换由model zoo托管的tfjs convertor的冻结推断图。
转换成功,但是当我加载模型时,得到以下输出:
Error importing the graph: block_shape must be positive for 'MobilenetV2/expanded_conv_7/depthwise/depthwise/SpaceToBatchND' (op: 'SpaceToBatchND') with input shapes: [1,?,?,384], [2], [2,2] and with computed input tensors: input[1] = <0 0>, input[2] = <[0 0][0 0]>.
Process finished with exit code 2
我尝试转换mobilenet冻结的图,然后加载它,成功了。 我用于加载转换后的模型的脚本是:
graph_def = None
graph = None
model_file = "tensorflowjs_model.pb"
print('Loading graph definition ...', file=sys.stderr)
try:
with tf.gfile.GFile(model_file, "rb") as f:
graph_def = tf.GraphDef()
graph_def.ParseFromString(f.read())
except BaseException as e:
parser.exit(2, 'Error loading the graph definition: {}'.format(str(e)))
print('Importing graph ...', file=sys.stderr)
try:
assert graph_def is not None
with tf.Graph().as_default() as graph: # type: tf.Graph
tf.import_graph_def(
graph_def,
name=''
)
except BaseException as e:
parser.exit(2, 'Error importing the graph: {}'.format(str(e)))