TensorFlow Machine Learning Image Recognition Python API Tutorial
TensorFlow is an open-source software library for dataflow programming across a range of tasks. It is a symbolic math library and is also used for machine learning applications such as neural networks.
It is the fastest and simplest way to do image recognition using CPU with inception-v3 on your computer without any GPU because it is just a Python API.
In this tutorial, I will let you know how to perform TensorFlow Machine Learning Image Recognition to classify your image. It is just very easy to recognize the image by using a pre-trained model.
Download Docker
Go to the docker official website and download docker community. After installing the docker, open it on your computer.
//www.docker.com/community-edition#/download
Install and run Tensorflow via Docker
In your terminal enter the command below to install and start tensorflow with CPU.
docker run -it -p 8888:8888 tensorflow/tensorflow
Cloning the TensorFlow model’s repo from GitHub
Open your terminal and insert the following commands line.
git clone github.com/tensorflow/models.git cd models/
Run the classify_image.py file
In your terminal run command to run classify_image.py, this will download a pre-trained model online which will help you in recognizing your image later.
cd tutorials/image/imagenet/ python classify_image.py
Download image from google
Perform Image Recognition
Enter the following command line to perform image recognition function via python.
python classify_image.py --image_file Toy-dog-bread-playing.jpg
TensorFlow Machine Learning Image Recognition Python API Results
You can see the result in your terminal after you execute the image recognition command.
Pomeranian (score = 0.98215)
keeshond (score = 0.00336)
chow, chow chow (score = 0.00095)
toy poodle (score = 0.00026)
papillon (score = 0.00024)
Yeah, now you have done the image recognition in your laptop within few seconds to get the results.