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

Callback using Function Pointer (in C), interface (in Java) and EventListener pattern
Note : Read the original document at http://som-itsolutions.blogspot.in/2017/01/blog-post_24.html “In computer programming, a callback is a reference to executable code, or a piece of executable...

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

How do i get best Campus / Off Campus Placement?
Companies are looking for Skilled Freshers. So build your technical skills while doing MCA / BTech / BCA / BSc (IT or CS) into below areas- 1. Strong your programming & debugging skills ...

Xamarin Evolve 2016
Xamarin is one of the best cross-platform frameworks I have ever seen in my life. That is the biggest sell, you can write 1 mobile app and then “tailor” it for 3 different platforms. Great....

What Are IT Industries Performance Metrics?
1. Outstanding Expectation: Eligible to get Promotion easily and good salary hike. Always preferrable to go abroad. 2. Exceed Expectation: Can get Promotion as per schedule of company with good salary...
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