How to use the tfserver.process_classification_prediction function in tfserver

To help you get started, we’ve selected a few tfserver examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github visipedia / tf_classification / tfserving / client.py View on Github external
image_data = []
  for fp in args.image_paths:
    with open(fp) as f:
      data = f.read()
    image_data.append(data)

  # Get the predictions
  t = time.time()
  predictions = tfserver.predict(image_data, model_name=args.model_name,
    host=args.host, port=args.port, timeout=args.timeout
  )
  dt = time.time() - t
  print("Prediction call took %0.4f seconds" % (dt,))

  # Process the results
  results = tfserver.process_classification_prediction(predictions, max_classes=args.num_results)

  # Print the results
  for i, fp in enumerate(args.image_paths):
    print("Results for image: %s" % (fp,))
    for name, score in results[i]:
      print("%s: %0.3f" % (name, score))
    print()

tfserver

Tensor Flow Model Server

Apache-2.0
Latest version published 1 year ago

Package Health Score

58 / 100
Full package analysis

Similar packages