TensorFlowSharp icon indicating copy to clipboard operation
TensorFlowSharp copied to clipboard

TensorFlow Converting Speech Commands Model Example to C#

Open nadir500 opened this issue 7 years ago • 1 comments

hello i need to convert those blocks from tensorflow python to c# code:

def run_graph(wav_data, labels, input_layer_name, output_layer_name,
              num_top_predictions):
  """Runs the audio data through the graph and prints predictions."""
  with tf.Session() as sess:
    # Feed the audio data as input to the graph.
    #   predictions  will contain a two-dimensional array, where one
    #   dimension represents the input image count, and the other has
    #   predictions per class
    softmax_tensor = sess.graph.get_tensor_by_name(output_layer_name)
    predictions, = sess.run(softmax_tensor, {input_layer_name: wav_data})

    # Sort to show labels in order of confidence
    top_k = predictions.argsort()[-num_top_predictions:][::-1]
    for node_id in top_k:
      human_string = labels[node_id]
      score = predictions[node_id]
      print('%s (score = %.5f)' % (human_string, score))

    return 0

to your sharp library. can someone help me with it?

nadir500 avatar Jun 09 '18 15:06 nadir500

Were you able to do that?

decoybitch avatar May 20 '19 08:05 decoybitch