TF服务GRPC Resnet50输出解析

时间:2019-03-24 19:27:35

标签: python tensorflow-serving

我一直在尝试运行Resnet-50 TF模型文件(PB文件/ TF服务文件)并尝试了解输出。来自https://github.com/tensorflow/models/tree/master/official/resnet

的模型文件

模型输出为这种形状

  

saved_model_cli show --dir'resnet_v2_fp32_savedmodel_NCHW / 1538687196'-全部

MetaGraphDef with tag-set: 'serve' contains the following SignatureDefs:

signature_def['predict']:
  The given SavedModel SignatureDef contains the following input(s):
    inputs['input'] tensor_info:
        dtype: DT_FLOAT
        shape: (64, 224, 224, 3)
        name: input_tensor:0
  The given SavedModel SignatureDef contains the following output(s):
    outputs['classes'] tensor_info:
        dtype: DT_INT64
        shape: (64)
        name: ArgMax:0
    outputs['probabilities'] tensor_info:
        dtype: DT_FLOAT
        shape: (64, 1001)
        name: softmax_tensor:0
  Method name is: tensorflow/serving/predict

signature_def['serving_default']:
  The given SavedModel SignatureDef contains the following input(s):
    inputs['input'] tensor_info:
        dtype: DT_FLOAT
        shape: (64, 224, 224, 3)
        name: input_tensor:0
  The given SavedModel SignatureDef contains the following output(s):
    outputs['classes'] tensor_info:
        dtype: DT_INT64
        shape: (64)
        name: ArgMax:0
    outputs['probabilities'] tensor_info:
        dtype: DT_FLOAT
        shape: (64, 1001)
        name: softmax_tensor:0
  Method name is: tensorflow/serving/predict

我能够通过TF服务为该模型提供服务,并获得输出(client gist);但是,如何获得该类,人类可读的标签

#input

in tf shape', (32, 224, 224, 3)) #input 32 batches of 224*224 image

#ouput

('scores output', (32, 1001))# do we need to do softmax of this to get calls ?

('labels output', (32,)) # or do we get the classes here

#sample output printed
('Label', 535, ' Score ', array([1.7646320e-04, 3.4607644e-04, 2.8857682e-04, ..., 8.6246226e-05,
       3.6872298e-04, 7.6855574e-04], dtype=float32))

任何类似https://gist.github.com/yrevar/942d3a0ac09ec9e5eb3a的映射

0 个答案:

没有答案