Showing posts with label Image recognition. Show all posts
Showing posts with label Image recognition. Show all posts

Thursday, September 28, 2017

How to : Your VOICE Based AI

#SpeechRecognition #VoiceBasedAI #DeepLearning #SpeechToText #Abzooba Created a simple Voice based AI Assistant using speech recognition library in python. It does the following : 1) Understands voice 2) Can convert speech to text ( My starting point , as wanted an Assistant who can help me write my stories )

3) Perform simple actions ,Like ?

3A) You ask for the current time and get's it instantly. 3B) Understands the intent or context in the speech and can perform specific action e.g. When I ask Rudra ( Have named my AI after Lord Shiva ) to find the location of a place , it automatically opens Google Map with the particular location , or when I ask to find a similar kind of shirt by providing the picture of a blue shirt , it scans the image and then find similar looking shirt in #Amazon or #Myntra.



Interesting, isn't it?

Pray to Lord Rudra and get started !


Let's look into how I did it.


Some Important Stuff FIRST -

For Speech Recognition, you need Speech Recognition library.

Do a pip install and get it installed.

pyaudio will also be required.

I am using Keras ( which using tensorflow backend) here for further processing .

Google has a great Speech Recognition API. This API converts spoken text (microphone) into written text (Python strings), briefly Speech to Text.

text-to-speech (TTS) system converts normal language text into speech.



Let's Look into the WorkFlow :


Let's see how it works :


A)  I say what TIME is it ....

Good, let's move to more complex stuff !

B)  I say to find me a Location like let's say I ask - Where is Abzooba ?


Automatically opens up Chrome browser with Goggle Map location the particular address.




Great , now let's move to more Complex things .

C) I show an Image to Rudra - I have kept the image in a folder as for now but once you create a simple UI along with it you can just upload the image .


I ask Rudra to search for similar item in #Myntra

Rudra scans the image and then automatically opens up Myntra for the possible choices.







Tuesday, September 26, 2017

Image Classification - Deep Learning

#github project  -  how to loop through a folder containing multiple images and classifying them using Keras and Pre-trained Networks. #tensorflow #keras #CNN #Neuralnet #INCEPTIONV3 #Machinelearning #DeepLearning


ImageClassificationDeepLearning

Here I will show how to loop through a folder containing multiple images and classifying them using Keras and Pre-trained Networks.
#TENSORFLOW #KERAS #NN #NEURALNET #INCEPTIONV3 #MACHINELEARNING #DEEPLEARNING
Our brains make vision seem easy. It doesn't take any effort for humans to tell apart a lion and a jaguar, read a sign, or recognize a human's face. But these are actually hard problems to solve with a computer: they only seem easy because our brains are incredibly good at understanding images.


How it helps ? 

Let’s say you have a folder wherein Multiple images get uploaded – best example will be like OLX or Quickr which are free Buy & Sell websites. Now, you need to determine if any harmful things ( e.g. Gun etc) are being bought and sold .








SEVERAL PRE-TRAINED NETWORKS :
  • VGG16, VGG19, ResNet50, Inception V3, and Xception
State-of-the-art deep learning image classifiers in Keras
Keras ships out-of-the-box with five Convolutional Neural Networks that have been pre-trained on the ImageNet dataset: VGG16 VGG19 ResNet50 Inception V3 Xception
Inception V3
The goal of the inception module is to act as a “multi-level feature extractor” by computing 1×1, 3×3, and 5×5 convolutions within the same module of the network — the output of these filters are then stacked along the channel dimension and before being fed into the next layer in the network. The original incarnation of this architecture was called GoogLeNet, but subsequent manifestations have simply been called Inception vN where N refers to the version number put out by Google.



Friday, September 22, 2017

Let’s first write a simple Image Recognition Model using Inception V3 and Keras

Image Recognition

#TENSORFLOW #KERAS #NN #NEURALNET #INCEPTIONV3 #MACHINELEARNING #DEEPLEARNING

Our brains make vision seem easy. It doesn't take any effort for humans to tell apart a lion and a jaguar, read a sign, or recognize a human's face. But these are actually hard problems to solve with a computer: they only seem easy because our brains are incredibly good at understanding images.

SEVERAL PRE-TRAINED NETWORKS :

VGG16, VGG19, ResNet50, Inception V3, and Xception

State-of-the-art deep learning image classifiers in Keras

Keras ships out-of-the-box with five Convolutional Neural Networks that have been pre-trained on the ImageNet dataset:

  1. VGG16
  1. VGG19
  1. ResNet50
  1. Inception V3
  1. Xception



Inception V3


The goal of the inception module is to act as a “multi-level feature extractor” by computing 1×13×3, and 5×5 convolutions within the same module of the network — the output of these filters are then stacked along the channel dimension and before being fed into the next layer in the network.
The original incarnation of this architecture was called GoogLeNet, but subsequent manifestations have simply been called Inception vN where N refers to the version number put out by Google.

LET'S WRITE A NICE LITTLE PROGRAM TO CLASSIFY IMAGES 

What are we going to Detect?
What does this Image say to a Computer?



Let's check it out :

import numpy as np
from keras.preprocessing import image
from keras.applications import inception_v3

# Load pre-trained image recognition model
model = inception_v3.InceptionV3()

# Load the image file and convert it to a numpy array
img = image.load_img('../input/Huggies.jpg', target_size=(299, 299))
input_image = image.img_to_array(img)

# Scale the image so all pixel intensities are between [-1, 1] as the model expects
input_image /= 255.
input_image -= 0.5
input_image *= 2.

# Add a 4th dimension for batch size (as Keras expects)
input_image = np.expand_dims(input_image, axis=0)

# Run the image through the neural network

predictions = model.predict(input_image)

# Convert the predictions into text and print them
predicted_classes = inception_v3.decode_predictions(predictions, top=1)
imagenet_id, name, confidence = predicted_classes[0][0]
#Let's print what the DL Program say
print("This is a {} with {:.4}% confidence!".format(name, confidence * 100))

Output: This is a diaper with 95.24% confidence!

Thursday, September 14, 2017

Did you know TensorFlow is Life-Saving ? Read- on

#MachineLearning #DeepLearning #ML #AI #ArtificialIntelligence #TensorFlow

Beginner’s guide to Tensorflow

Did you know TensorFlow is Life-Saving ? Read- on

INTRODUCTION:

The primary software tool of Deep Learning is TensorFlow. It is an open source artificial intelligence library, using data flow graphs to build models.

 It allows developers to create large-scale neural networks with many layers.

USED FOR:

TensorFlow is mainly used for:

1)  Voice/Sound Recognition
2)  Text Based Applications
3)  Image Recognition
4)  Video Detection


INTERESTING FACTS :

 Nasa ( National Aeronautics and Space Administration) is designing a system with TensorFlow for orbit classification and object clustering of asteroids. As a result, they can classify and predict NEOs (near earth objects). ( So, in a way TensorFlow is life-saving!!! )




NOW TECHNICAL STUFF :

TensorFlow is a library for numerical computation where data flows through the graph.

 Data in TensorFlow is represented by n-dimensional arrays called Tensors.

Graph is made of data(Tensors) and mathematical operations
§  Nodes on the graph: represent mathematical operations. 
§  Edges on the graph: represent the Tensors that flow between operations. 

There is one more aspect in which TensorFlow is very different from any other programming language.

In TensorFlow, you first need to create a blueprint of whatever you want to create. While you are creating the graph, variables don’t have any value. Later when you have created the complete graph, you have to run it inside a session, only then the variables have any values.

import tensorflow as tf  


Graph in TensorFlow:

GRAPH is the backbone of TensorFlow and every computation/operation/variables reside on the graph. Everything that happens in the code, resides on a default graph provided by TensorFlow. You can access this graph by:

graph = tf.get_default_graph()

Next big thing, Session!

A GRAPH  is used to define operations, but the operations can  only run within a SESSION. Graphs and sessions are created independently of each other.

Sess = tf.Session()
Tensors in Tensorflow:

TensorFlow holds Data in tensors

i)                Constants

are constants whose value can’t be changed. You can declare a constant like this: 

              a=tf.constant(1.0)

ii)                   Variables

are again Tensors which are like variables in any other language. 

b=tf.Variable(2.0,name=None)
iii)                 PlaceHolders


are tensors which are waiting to be initialized/fed. Placeholders are used for training data which is only fed when the code is actually run inside a session. What is fed to Placeholder is called feed_dict. Feed_dict are key value pairs for holding data:

a = tf.placeholder("float")

Followers