googletensorflow-serving

Test image recognition

TensorFlow Serving is ready to be used with the ResNet model. The necessary training data is located at /opt/bitnami/model-data.

First, download the image that you want to be recognised:

$ cd /tmp
$ curl -LO 'https://tensorflow.org/images/blogs/serving/cat.jpg'

In order to send the query to the server, you just need to execute the following command:

$ resnet_client_cc --image_file=cat.jpg

You will get a response from the server with an ID that represent the image category. The output can be similar to this:

Query output using a sample image

Once you have that ID, you can get the human friendly label by checking the mapping in this file;

As an alternative, you can also query the server remotely. As you will need a client to make the requests, we recommend you to use our Bitnami Docker TensorFlow ResNet container.

You just need to execute the following commands (substitute the SERVER_IP placeholder with the real IP address of your server):

$ docker run --name tensorflow-resnet -d bitnami/tensorflow-resnet:latest
$ docker exec tensorflow-resnet resnet_client_cc bash
$ curl -LO 'https://tensorflow.org/images/blogs/serving/cat.jpg'
$ resnet_client_cc --server_port=SERVER_IP:9000 --image_file=cat.jpg
Last modification April 10, 2024