Lesson 13: Introduction to AI and Face Detection

Lesson Description

Learn about the difference between human intelligence and Artificial Intelligence (AI), the applications of AI, and the advantages and disadvantages of AI.

Intelligence

What is intelligence? What makes humans intelligent beings? How to classify a machine as intelligent?

All these questions would pop up in your mind when you hear the word Artificial Intelligence or AI. We will look at the answers to all these questions along with the various applications of AI here.

Intelligence is one’s capacity for logic, understanding, self-awareness, learning, emotional knowledge, planning, creativity, and problem-solving.

Human intelligence can be described as

  1. The ability to perceive, understand and analyze information.
  2. The ability to learn and increase knowledge.
  3. The ability to make decisions based on knowledge.

Animal Intelligence

In most animals, their skills and abilities are restricted to survival. Here are some examples:

  1. Dolphins: Dolphins are extremely sociable creatures with a highly developed ability to adapt to their habitat. They help one another when injured or ill and, thanks to their individually distinct calls, they’re able to pass on their knowledge to others.
  2. Parrots: These birds can recognize different human faces and have a high aptitude for communication. Besides these, parrots have an excellent memory which helps them solve complex problems (like how to remember your best friend’s birthday).
  3. Elephants: Elephants boast the largest brain of all land animals. These animals are renowned for their ability to socialize and can express a wide range of emotions, including happiness and compassion, as well as pain and grief. They display acts of altruism and self-awareness. With a greater memory than even us humans, an elephant truly never forgets!

Are Computers Intelligent?

Computers are used to

  • Store information in their memory like documents, images, and videos, which you can access immediately.
  • Run programs that interact with the user to help solve his problems like going calculations, etc.
  • Play games.
  • Watch movies and videos.
  • Surf on the Internet.

The task is defined and the computer runs programs to get the result. This is not termed intelligence because there is no learning process involved in this. Computers are just following some set of predefined instructions.

But, when computers are equipped with a program that learns and acts based on their environment, they can be termed as intelligent. Let’s see some examples:

  1. Self-Driving Cars: They can recognize their environment and act accordingly.
  2. Emotion Identifiers: They can identify the emotion of human using their knowledge.
  3. AI Bots In-Game: They can play the game as if a human is playing.
  4. Alexa or Home pod (Siri): It recognizes what you say and reacts accordingly.

               Face Expression Detection                                                                  Games             

Computer Vision                                                                                Chats

Artificial Intelligence

It is the study and design of intelligent agents (computers) which have the ability to analyze the environments and produce actions that maximize success. A computer is termed intelligent if it has the ability for gathering information, analyze it to make decisions, and act to complete a task automatically with very little to no human intervention.

Advantages of AI

There are many advantages that an AI machine has over humans. Some of them are:

  1. Speed of execution:Computers have better memories. They can be fed a large amount of information and can retrieve it almost instantaneously. While a doctor makes a diagnosis in ~10 minutes, an AI system can make a million in the same duration.
  2. They are not lazyComputers don’t require sleep the way humans do. They can calculate, analyze, and perform tasks tirelessly and round the clock without wearing out.
  3. Accuracy: Computers have a very high accuracy in some tasks.
  4. Less Biased: Computers are not affected or influenced by emotions, feelings, wants, needs, and other factors that often cloud our judgment and intelligence.

AI vs Human Intelligence

Let us see the difference between artificial intelligence and human intelligence.

ARTIFICIAL INTELLIGENCE HUMAN INTELLIGENCE
Created by human intelligence Evolutionary process
Process information faster Slower
Highly objective May be subjective
More Accurate Maybe less accurate
Cannot adapt to changes well Easily adapt to changes
Cannot multitask that well Easily multitask
Below average social skills Better social skills on average
Optimization Innovation
Cheap Expensive
Biased Biased

Application of AI

  1. Security: Security cameras can use AI to assess footage in real-time and recognize criminal behavior, allowing for immediate reporting and addressing of criminal activity.
  2. Maintenance: It can be used to analyze road visuals, enabling cities to identify when and where repairs should be done, saving money and improving safety.
  3. Predicting Future Needs: Smart cities are using AI to anticipate citizens’ future needs, track energy usage to identify when new sources are needed or sustainable practices can be implemented, and forecast and plan for property developments.
  4. Controlling PollutionScientists have created a technology using AI and machine learning to assess current pollution levels and forecast them for two hours, giving authorities the ability to make proactive decisions to reduce environmental impact.
  5. Parking Systems: License plate recognition technology is employed by car parks to identify vehicles that have stayed beyond the allotted time.

Face Detection

Face detection is the action of locating human faces in an image and optionally returning different kinds of face-related data

The method of face detection in pictures is complicated because, well, human faces are widely different from one another! They can have different poses, expressions, positions, orientations, skin colors, glasses or facial hair or not, etc.

Knowledge-Based Detection

The knowledge-based method depends on a set of rules and is based on human knowledge to detect faces. For example, a face often appears with two eyes that are symmetric to each other, a nose, and a mouth.

Pros:

  1. Easy to come up with simple rules.
  2. Based on the coded rules, facial features in an input image are extracted first, and face candidates are identified.

Cons:

  1. Difficult to translate human knowledge into rules precisely.
    1. Detailed rules fail to detect faces, like the rule that, ‘A person must have two eyes’: According to this rule, no face will be identified if the image has 1 eye.
    2. General rules may find many false positives: Like there is an eye in a face. According to this, the face will be identified in this tattoo of a similar-looking eye.
  2. This approach alone is insufficient and unable to find many faces in multiple images.

Feature-Based Detection

Feature-based detection uses what is known as face landmarks to detect faces. Face landmarks are a set of easy-to-find points on a face, such as the pupils or the tip of the nose.

By default, there are 68 predefined landmark points.

Pros:

  1. Features are invariant to pose and orientation change.
  2. This method has a higher chance of face detection.

Cons:

  1. Difficult to locate facial features due to noise in the images.
  2. Difficult to detect features in complex backgrounds.

Face Detection Blocks in PictoBlox

The Face Detection extension in PictoBlox has blocks dedicated to face detection. Let’s explore some blocks.

Follow the steps below:

  1. Create a New file in PictoBlox App.
  2. Next, click on the Add Extension button and add the Face Detection
  3. The face detection models will be downloaded which may take few seconds to load.
  4. Once downloaded you will get a message saying “Model loaded successfully”.
  5. Let’s add the test image:

    1. Scan the QR Code to download the Boy and Girl
    2. Double Click the Backdrop button as shown. You will get the edit sign. Click it.
  6. This will open the Backdrop Settings. Click on the first icon in the Bottom corner to add a backdrop.
  7. Click on the Upload button.
  8. Select the downloaded Image.
  9. Move the Tobi so that the stage is cleared.

Face Detection Blocks

  1. Controlling Camera Feed: You can control the camera feed on the stage using turn () video on stage with () % transparency block.

You can change the following parameters of the block:

  1. Camera state:
    • OFF – The video feed on the stage will stop.
    • ON – The video feed on the stage will start.
    • ON flipped – The video feed on the stage will start with the video mirrored. So, your right hand will be shown as left hand and vice versa.
  2. Transparency: This parameter makes the video translucent. O is defined as the camera feed will be shown on the stage and 100 is the video will fade out completely from the stage.
  1. Analyzing Image on Stage: The analyse image from () block analyses the image and saves the face information locally, which can be accessed using other blocks similar to computer vision.

Drag analyse image from () block, change the feed as stage and click on the block to analyze the image.

  1. Get # faces: Once you have analyzed the images, you can use the get # faces block to get the number of faces recognized in the image. For the image being analyzed, you will get 2.

  2. Get expression of face (): The get expression of face () block reports the recognized expression of the selected face. If the face selected is not detected then it reports NULL. For the first face in the image being analyzed, the expression is Happy.

  3. Is expression of face () (): The is expression of face () () block checks whether the selected face has a particular emotion or not. If the emotion matches, then the block returns true, else false. E.g., for face 1 in the image, the emotion is Happy, so it returns True.

  1. Get () of face (): The get () of face () block reports the following attributes of the image:
  • X position: X coordinate of the center of the image on the stage
  • Y position: Y coordinate of the center of the image on the stage
  • Width: Width of the face
  • Height: Height of the face

Using this block, you can make the bounding box for the face like this:

  1. Get () position of landmark () of face (): The get () position of landmark () of face () block reports the x and y position of the selected landmark (number from 1 to 68) of the selected face. Using this block, you can draw the landmark points on the stage like this:

 

 

 

 

Make sure you finish and submit the assignment, as well as take the quizbefore moving on to the next lesson.

Table of Contents