Разбор TF, обслуживающий GRPC Resnet50 - PullRequest
0 голосов
/ 24 марта 2019

Я пытался запустить файл модели Resnet-50 TF (файл PB / файл обслуживания TF) и попытаться понять вывод. Файл модели от https://github.com/tensorflow/models/tree/master/official/resnet

Выход модели в этой форме

сохраненный_модель_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 Serving и получить вывод ( 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

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...