UrbanPro
true

Learn Mobile App Development from the Best Tutors

  • Affordable fees
  • 1-1 or Group class
  • Flexible Timings
  • Verified Tutors

Search in

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

What is Intent in Android Development?
Intent is used to swith between activities In Android there are different ways and differnet codings to do different operations, But to switch between Activities there is only on option available that...

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

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...

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...

Implementation of a state machine for a long running background task in Android
In the below example I will show how we can break a long-running background task running in a service into different states of a state machine and notify the front end UI about each and every stage as...
X

Looking for Mobile App Development Classes?

The best tutors for Mobile App Development Classes are on UrbanPro

  • Select the best Tutor
  • Book & Attend a Free Demo
  • Pay and start Learning

Learn Mobile App Development with the Best Tutors

The best Tutors for Mobile App Development Classes are on UrbanPro

This website uses cookies

We use cookies to improve user experience. Choose what cookies you allow us to use. You can read more about our Cookie Policy in our Privacy Policy

Accept All
Decline All

UrbanPro.com is India's largest network of most trusted tutors and institutes. Over 55 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 7.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