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

For more info about our Kubernetes solution, check our guide Perform Machine-Based Image Recognition With TensorFlow On Kubernetes.

Last modification January 4, 2019