Find the best tutors and institutes for Mobile App Development

Find Best Mobile App Development Training

Please select a Category.

Please select a Locality.

No matching category found.

No matching Locality found.

Outside India?

Search for topics

How to Make an Awesome Image Classifier With Tensorflow in iOS in less than 5 minutes.

Abhishek Dwivedi
22/05/2018 0 0

What is TensorFlow?

Tensorflow is an Open source machine learning framework. Its a library for doing Complex Numerical Computation to build machine learning models from scratch. TensorFlow is cross-platform. It runs on nearly everything: GPUs and CPUs—including mobile and embedded platforms.

What is an image classifier?

Image Classifier classifies any given image in categories using trained models. Let's say you train a model by providing 50 images of a dog. Once the model is trained to recognize dogs, you can test it out by providing any given image and the trained model will be able to recognise whether the given image is of a dog or not. 

How do I make an image classifier with TensorFlow?

Step 1. SETTING UP THE ENVIRONMENT

Install Python, TensorFlow and download a TensorFlow repository.

  • Python(pip) - https://www.python.org/downloads/

  • TensorFlow - pip install tensorflow

  • Clone a Tensorflow repo - git clone https://github.com/googlecodelabs/tensorflow-for-poets-2

Step 2. PREPARING THE DATASET

  • Go inside the tf_filesfolder in the tensorflow-for-poets-2folder.

  • Create a parent folder and inside that create sub folders representing the categories.

  • For example, create a parent folder called people and create sub-folders inside the ‘people’ folder based on categories, namely, men, women and children.

  • Place photos of men, women and children in the respective folders. This will be the dataset and will be used by TensorFlow for training.

Step 3. TRAINING THE MODEL

In the command line, go inside the sensor flow-for-poets-2folder and type the following command.

python -m scripts.retrain--bottleneck_dir=tf_files/bottlenecks --model_dir=tf_files/models/mobilenet_0.50_224 --summaries_dir=tf_files/training_summaries/mobilenet_0.50_224 --output_graph=tf_files/retrained_graph.pb--output_labels=tf_files/retrained_labels.txt--architecture=mobilenet_0.50_224 --image_dir=tf_files/people //where people is the parent folder with the training set.

This creates graphs and files for image recognition and classification and will be used to categorize any given image based on the training set. 


Step 4. TESTING THE MODEL

  • Now that the model is trained, its time to test if it works.
  • Download a test image of a man or a woman and place it inside the user_datafolder.
  • In the command line, go inside the tensorflow-for-poets-2folder and type the following command.

python -m scripts.label_image--graph=tf_files/retrained_graph.pb  --  image=user_data/men.jpg//where men.jpgis the test image 

OUTPUT

Evaluation time (1-image) 0.25 seconds

men     0.91115780

women 0.08678748 

  

0 Dislike
Follow 2

Please Enter a comment

Submit

Other Lessons for You

Broadcast Receiver in Android
How you ever wonder how all your app detects OS events like when the internet is turned ON, the incoming call is coming, battery low etc. like that? Yes, it is because of Android OS build in Event, "Broadcast...

Ranjith K P | 09/07/2018

0 0
0

The Best Option JavaScript Language For Developers
We already know about JavaScript. But today I will be discussing JavaScript features and JavaScript development process. I was wonder about JavaScript last 10 years. Because JavaScript can give us frontend...

Shibaji Debnath | 19/02/2018

0 0
0

What Is Swift?
1. It is a new programming language that was created by Apple. 2. It is entirely built from the ground up. 3. It was announced at the WWDC in June of 2014. 4. But it was in development for number of...
R

Rajkumar G. | 23/12/2017

0 0
0

Learning Path For Mobile Application Development
I. Traditional Approach: 1. Native Android Application Development: Android is a mobile operating system that runs on phones, tablets, smartwatches, TVs and more. You can learn Android Application Development...

Aman Juneja | 23/11/2017

1 0
0

What Would Be Life Cycle Of A Fresher After Campus In An IT Company?
1. Basic Technical Training: Since freshers are not subject matter experts so gone through 3 - 6 months basic technical training within Organization. 2. Technical Assessment: HR sends freshers to various...

Amit K. | 28/06/2017

0 0
0

Find Best Mobile App Development Training?

Find Now »

UrbanPro.com is India's largest network of most trusted tutors and institutes. Over 25 lakh students rely on UrbanPro.com, to fulfill their learning requirements across 1,000+ categories. Using UrbanPro.com, parents, and students can compare multiple Tutors and Institutes and choose the one that best suits their requirements. More than 6.5 lakh verified Tutors and Institutes are helping millions of students every day and growing their tutoring business on UrbanPro.com. Whether you are looking for a tutor to learn mathematics, a German language trainer to brush up your German language skills or an institute to upgrade your IT skills, we have got the best selection of Tutors and Training Institutes for you. Read more