Tensorflow item recognition

Leveraging Google’s Tensorflow Machine Learning libraries for item recognition in images is fantastically easy to get going. The below Dockerfile will setup a container with everything required and allow the user to feed a URL to a file for classification:

Dockerfile:
Download raw from here: https://pastebin.com/raw/mdJ225vp

Save the above into a file called “Dockerfile”.
Enter the directory where the Dockerfile is saved and build the Docker image:

Verify the Docker image:

Run the image. We’ll expose SSH on port 22 on the container as 2222 on the host:

Verify the local Docker gateway IP using the container ID (81f13360885f in this case – use “docker ps” to find out):

SSH and execute the image classification script (password: “tensorflow”):

This is the image we’ve pulled down:

And this is the classification result:

Not too bad 🙂 Tensorflow accurately detects that the image contains a scooter, a crash helmet and even sees the disk brake on the scooter! Try with any image URL to see what Tensorflow will classify your image as. Have fun!