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.
Go to the docker official website and download docker community. After installing the docker, open it on your computer.
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
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.
Download image from google
Go to google and download image from this link //www.google.com/search?q=toy+dog&safe=active&tbm=isch&tbs=rimg:CQUhWmMfQ3IBIjha3hCRfs6gkCx1C0PyJxdBRRjs2pkeu3l-z7qRb-XJ-aCnOIh4tTZ5lYN4lv1X2zljgVC6-mkyLSoSCVreEJF-zqCQETYHpcIrCIRzKhIJLHULQ_1InF0ERQzrqU62lQNsqEglFGOzamR67eRHxSs9SXdXylioSCX7PupFv5cn5ETnnN9Lz5Ne4KhIJoKc4iHi1NnkRpItxKHILo-QqEgmVg3iW_1VfbORFFepFlQMMDxioSCWOBULr6aTItEZYZHWYy1LhG&tbo=u&sa=X&ved=2ahUKEwistPyn7dLcAhUYT30KHRy5CpYQ9C96BAgBEBs&biw=1440&bih=726&dpr=1#imgrc=BSFaYx9DcgEzAM:
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.