Category: Machine Learning

  • Blog
  • Category: Machine Learning

Artificial Intelligence vs Machine Learning vs Deep Learning

Let’s resolve the biggest confusion between all comprehensive technical terms like artificial intelligence, machine learning and deep learning. Artificial intelligence is a broader space under which Machine Learning and Deep Learning are subsets of it.   Let’s understand briefly about each of them to get a better picture. The concept of artificial intelligence came into existence in 1956. But data at that time was not sufficient to calculate accurate results. Artificial Intelligence   Artificial Intelligence is a technique by which machines demonstrates intelligence or behavior like humans. In AI, machine can learn from experience, like new born kids do. So from new input data, machine can adjust new responses. We can consider artificial intelligence as a project of creating Huge Monument which can take centuries to build. So the one who started building it, could not even see it fully built. AI researchers started working on bricks and bases of the project by creating learning algorithms so that future researchers will use it to build smart intelligence system. Example of Artificial Intelligence: Apple Siri, Microsoft Cortana, Tesla Self Driving Cars and many more. Machine Learning In Artificial intelligence, it was difficult to train complex decision making operation models of the Human brain. “Machine Learning is an application Artificial intelligence which enables machine to learn from statistical data to improve with experience.” The designed algorithms in Machine Learning are developed in such a way, that it can learn and improve the results when new data is provided. Example of Machine Learning: Netflix, Google Maps Elaborate Examples: Netflix – Depending upon what type of movies and series you watch, Netflix will suggest you same type of movies and series to you in Recommended section. Google Maps – Google map analyses the traffic and suggests you the fastest routes to your destination. Deep Learning Deep learning is a part of a broader family of Machine Learning that is inspired by the functionality of our brain cells called artificial neural network. It takes data connection between all the artificial neurons and adjust it according to the data parent. With the increase in the size of data parent ,more neurons is  added . You can relate Deep Learning as rocket a rocket engine which uses huge amount of data a fuel to process the algorithms. Deep Learning concept is not new but recently it’s hype has increased and getting a lot of attention. How Deep Learning Works at simple scale:   In above example, machine will validate all the criteria to check if the rectangle is a square. When it is nothing but nested hierarchy of conditions and checks. Deep learning does the same thing but a larger scale Above blog gives the brief difference of difference between different types of AI. Developing an application requires in depth knowledge and understanding of AI. If you want any assistant with AI application development you can always contact us. Techaroha Team is specialized in Block Chain and AI Application. Techaroha is One of the Best Software company to build application with a mix of Block Chain and AI.

Getting started with Machine Learning – Node.js integrated with Google Video-Intelligence

Machine Learning is an idea to learn from examples and experience, without being explicitly programmed. Instead of writing code, you feed data to the generic algorithm, and it builds logic based on the datasets given. In this article, we are going to cover a simple example of Machine Learning by integrating “Google Video-Intelligence” API with Node.js application. What is Google Video-Intelligence? Google under the project of Machine Learning has introduced Video-Intelligence. This makes video searchable and discoverable by extracting contents of a video with an easy to use REST API. furthermore, you can read more about google video intelligence on the google page. Prerequisites for Machine Learning Basic knowledge of Node.js applications Basic knowledge of Google Cloud Platform Step 1: Enable the Google Video-Intelligence API Sign into your google account with valid user credentials In the Google Cloud Platform Console, go to the Manage resources page and select or create a new project. Make sure that billing is enabled for your project. Also, you can find guidelines on the google docs link. Enable the Cloud Video Intelligence API. Step 2: Authenticating to a Cloud API Service To allow your application code to use a Cloud API, you will need to set up the proper credentials for your application to authenticate its identity to the service and to obtain authorization to perform tasks. The simplest authentication scheme is that of an API key. However, an API key does not allow you to authorize to the service, so it is only usable on public data or data you pass directly to the RPC API. Set up an API key After you enable a Cloud API, Go to “API & Services” through navigation menu. Click “Go to Credentials” to click on the Create Credentials button. Select “API key” from the options. You may wish to copy your key and keep it secure (you can also retrieve it from the API Manager→Credentials page). Set up a service account for machine learning Google Cloud Platform API authentication and authorization (commonly grouped together as “auth”) is typically done using a service account. in addition, A service account allows your code to send application credentials directly to the Cloud API. Go to “API & Services” through navigation menu. Click on “Create Credentials” and select “Service account key”. Select service account as “Compute engine default service account”, select key type as JSON and hit the Create button. Finally, GCP Console will generate a JSON key (as a .json text file), prompt you to download the file to your computer. The generated JSON key will be similar to the following sample JSON key: { “type”: “service_account”, “project_id”: “project-id”, “private_key_id”: “some_number”, “private_key”: “—–BEGIN PRIVATE KEY—–\n…. =\n—–END PRIVATE KEY—–\n”, “client_email”: “<api-name>api@project-id.iam.gserviceaccount.com”, “client_id”: “…”, “auth_uri”: “https://accounts.google.com/o/oauth2/auth”, “token_uri”: “https://accounts.google.com/o/oauth2/token”, “auth_provider_x509_cert_url”: “https://www.googleapis.com/oauth2/v1/certs”, “client_x509_cert_url”: “https://www.googleapis.com/…<api-name>api%40project-id.iam.gserviceaccount.com” } Install and initialize the Cloud SDK Download appropriate google cloud SDK to your OS platform. The installer starts a terminal window and runs the gcloud init command in windows (for other operating systems, manually run the same command). Go through the online guide for detailed information. Provide authentication credentials to your application code by running the following command. Replace [PATH] with the location of the JSON file that contains your credentials. gcloud auth activate-service-account –key-file=[PATH] Obtain an authorization token using the command: gcloud auth print-access-token Copy the access token at somewhere safe. Step 3: Integration with Node.js Application Considering you have already a basic Node.js application ready, we will explain how to use google REST APIs. In order to use video-intelligence, we need to install npm package containing client library. Open the command prompt in the project directory and install google cloud library using the following command npm install –save @google-cloud/video-intelligence Once the package is installed, we will write a code providing local storage video URL to the function. This function will convert the video into the base64 format and pass to the google video intelligence API. Code for Implementation // Imports the Google Cloud Video Intelligence library + Node’s fs library const video = require(‘@google-cloud/video-intelligence’).v1; const fs = require(‘fs’); // Creates a client const client = new video.VideoIntelligenceServiceClient(); /** * TODO(developer): Uncomment the following line before running the sample. */ // const path = ‘Local file to analyze, e.g. ./my-file.mp4’; const path = ‘avengers_trailer.mp4’; // Reads a local video file and converts it to base64 const file = fs.readFileSync(path); const inputContent = file.toString(‘base64’); // Constructs request const request = { inputContent: inputContent, features: [‘LABEL_DETECTION’], }; // Detects labels in a video client .annotateVideo(request) .then(results => { const operation = results[0]; console.log(‘Waiting for operation to complete…’); return operation.promise(); }) .then(results => { // Gets annotations for video const annotations = results[0].annotationResults[0]; const labels = annotations.segmentLabelAnnotations; labels.forEach(label => { console.log(`Label ${label.entity.description} occurs at:`); label.segments.forEach(segment => { let time = segment.segment; if (time.startTimeOffset.seconds === undefined) { time.startTimeOffset.seconds = 0; } if (time.startTimeOffset.nanos === undefined) { time.startTimeOffset.nanos = 0; } if (time.endTimeOffset.seconds === undefined) { time.endTimeOffset.seconds = 0; } if (time.endTimeOffset.nanos === undefined) { time.endTimeOffset.nanos = 0; } console.log( `\tStart: ${time.startTimeOffset.seconds}` + `.${(time.startTimeOffset.nanos / 1e6).toFixed(0)}s` ); console.log( `\tEnd: ${time.endTimeOffset.seconds}.` + `${(time.endTimeOffset.nanos / 1e6).toFixed(0)}s` ); console.log(`\tConfidence: ${segment.confidence}`); }); }); callback(labels); }) .catch(err => { console.error(‘ERROR:’, err); }); After giving the request some time (about a minute, typically), the same request returns annotation results in JSON format. Congratulations! You’ve sent your first request to Cloud Video Intelligence API. Note:- Google Video-Intelligence API is not a free service. You can get free credits for demo purpose. You want any assitance or want to develop you application in Machine Learning you can always contact us here. Resource- Google Video-Intelligence Docs