Вы ищете инструмент sumrize_graph .Запустите summarize_graph --in_graph=your_graph.pb
и он выдаст.Если вы используете Docker, вы можете найти sumrize_graph на любом изображении tensorflow/tensorflow
с тегом devel
.Например:
wget http://download.tensorflow.org/models/mobilenet_v1_2018_02_22/mobilenet_v1_1.0_224.tgz
tar xvf mobilenet_v1_1.0_224.tgz
docker run --rm -it -v $PWD:/data tensorflow/tensorflow:1.10.1-devel-py3
# Inside docker
cd /tensorflow
bazel build tensorflow/tools/graph_transforms:summarize_graph # This may take a while, use --jobs 4
./bazel-bin/tensorflow/tools/graph_transforms/summarize_graph --in_graph=/data/mobilenet_v1_1.0_224_frozen.pb
Вывод будет:
Found 1 possible inputs: (name=input, type=float(1), shape=[?,224,224,3])
No variables spotted.
Found 1 possible outputs: (name=MobilenetV1/Predictions/Reshape_1, op=Reshape)
Found 4254891 (4.25M) const parameters, 0 (0) variable parameters, and 0 control_edges
Op types used: 138 Const, 138 Identity, 27 FusedBatchNorm, 27 Relu6, 15 Conv2D, 13 DepthwiseConv2dNative, 2 Reshape, 1 AvgPool, 1 BiasAdd, 1 Placeholder, 1 Shape, 1 Softmax, 1 Squeeze
To use with tensorflow/tools/benchmark:benchmark_model try these arguments:
bazel run tensorflow/tools/benchmark:benchmark_model -- --graph=/data/mobilenet_v1_1.0_224_frozen.pb --show_flops --input_layer=input --input_layer_type=float --input_layer_shape=-1,224,224,3 --output_layer=MobilenetV1/Predictions/Reshape_1