Cristian Vasta

Cristian Vasta

1612063800

A Centralized System for Displaying and Stylizing Focus indicators Anywhere

Focus Rings

A centralized system for displaying and stylizing focus indicators anywhere on a webpage.

a gif showing focus rings in action

Motivation

When working on creating a complete keyboard navigation experience for Discord, we ran into a number of problems with rendering clean and consistent focus rings and were unable to find any suitable native alternatives. After a lot of trial and error, we landed on this system as a way to meet all of our needs. You can read more about the process we went through in this blog post.

Installation

This package is published under react-focus-rings and can be installed with any npm-compatible package manager.

Usage

This library is composed of two components: FocusRing and FocusRingScope.

FocusRingScope

FocusRingScope is responsible for providing a frame of reference for calculating the position of any FocusRing instances it contains. The containerRef prop takes a React.Ref that references the DOM element that should be used for these position calculations. You’ll want to include a FocusRingScope instance at the top level of your application. If a component creates a new scroll container, or is absolutely positioned within the viewport, you should add a new FocusRingScope.

function ScopeExample() {
  const containerRef = React.useRef<HTMLDivElement>(null);
  return (
    <div ref={containerRef} id="main">
      <FocusRingScope containerRef={containerRef}>
       {/* ... */}
      </FocusRingScope>
    </div>
  )
}

Keep in mind that the element provided to containerRef must be styled with position: relative or else the alignment calculations will be incorrect. If you find that FocusRing isn’t being rendered at all or its positioning is wrong, verify that you have a FocusRingScope in the correct places and that the containerRef element has the position: relative style.

FocusRing

The FocusRing is the main show. You can wrap any focusable element with a FocusRing and it will add the required focus/blur listeners and magically render the focus ring when the element receives focus. We recommend integrating this at the design primitive level, in custom components like Button or Link, so you get the focus ring behavior across your application with minimal effort.

function Button(props: ButtonProps) {
  return (
    <FocusRing>
      <button {...props} />
    </FocusRing>
  );
}
Props

FocusRing has a few props you can use to get the right behavior and alignment. If using TypeScript the type is exported as FocusRingProps

import {FocusRingProps} from 'react-focus-rings'
  • within - acts like :focus-within and will render the focus ring if any descendant is focused
  • enabled - controls whether the FocusRing is being rendered
  • focused - controls the focused state
  • offset - lets you adjust the alignment of the focus ring, relative to the focused element. Can be a number or Offset object
  • focusTarget - lets you choose a different element to act as the focus target for the ring. Must be used with ringTarget.
  • ringTarget - lets you choose a different element to render the ring around. Must be used with focusTarget.
  • focusWithinClassName - lets you apply a CSS class to the focused element when a descendant is focused. Like :focus-within.

Default Styling

The focus ring also relies on some default CSS styles in order to render properly. To make this work in your project, be sure to import the styles separately somwhere within your app with import "focus-rings/src/styles.css";.

Example

A complete, minimal example might look like this:

import * as React from "react";
import ReactDOM from "react-dom";

import { FocusRing, FocusRingScope } from "react-focus-rings";
import "focus-rings/src/styles.css";

function App() {
  const containerRef = React.useRef<HTMLDivElement>(null);
  return (
    <div className="app-container" ref={containerRef}>
      <FocusRingScope containerRef={containerRef}>
        <div className="content">
          <p>Here's a paragraph with some text.</p>
          <FocusRing offset={-2}>
            <button onClick={console.log}>Click Me</button>
          </FocusRing>
          <p>Here's another paragraph with more text.</p>
        </div>
      </FocusRingScope>
    </div>
  );
}

ReactDOM.render(<App />, document.body);

You can find a more complete example in the examples directory of this repository. You can find a hosted version of the example application here.

Download Details:

Author: discord

Source Code: https://github.com/discord/focus-rings

#react #reactjs #javascript

What is GEEK

Buddha Community

A Centralized System for Displaying and Stylizing Focus indicators Anywhere
Ruth  Nabimanya

Ruth Nabimanya

1620633584

System Databases in SQL Server

Introduction

In SSMS, we many of may noticed System Databases under the Database Folder. But how many of us knows its purpose?. In this article lets discuss about the System Databases in SQL Server.

System Database

Fig. 1 System Databases

There are five system databases, these databases are created while installing SQL Server.

  • Master
  • Model
  • MSDB
  • Tempdb
  • Resource
Master
  • This database contains all the System level Information in SQL Server. The Information in form of Meta data.
  • Because of this master database, we are able to access the SQL Server (On premise SQL Server)
Model
  • This database is used as a template for new databases.
  • Whenever a new database is created, initially a copy of model database is what created as new database.
MSDB
  • This database is where a service called SQL Server Agent stores its data.
  • SQL server Agent is in charge of automation, which includes entities such as jobs, schedules, and alerts.
TempDB
  • The Tempdb is where SQL Server stores temporary data such as work tables, sort space, row versioning information and etc.
  • User can create their own version of temporary tables and those are stored in Tempdb.
  • But this database is destroyed and recreated every time when we restart the instance of SQL Server.
Resource
  • The resource database is a hidden, read only database that holds the definitions of all system objects.
  • When we query system object in a database, they appear to reside in the sys schema of the local database, but in actually their definitions reside in the resource db.

#sql server #master system database #model system database #msdb system database #sql server system databases #ssms #system database #system databases in sql server #tempdb system database

Face Recognition with OpenCV and Python

Introduction

What is face recognition? Or what is recognition? When you look at an apple fruit, your mind immediately tells you that this is an apple fruit. This process, your mind telling you that this is an apple fruit is recognition in simple words. So what is face recognition then? I am sure you have guessed it right. When you look at your friend walking down the street or a picture of him, you recognize that he is your friend Paulo. Interestingly when you look at your friend or a picture of him you look at his face first before looking at anything else. Ever wondered why you do that? This is so that you can recognize him by looking at his face. Well, this is you doing face recognition.

But the real question is how does face recognition works? It is quite simple and intuitive. Take a real life example, when you meet someone first time in your life you don't recognize him, right? While he talks or shakes hands with you, you look at his face, eyes, nose, mouth, color and overall look. This is your mind learning or training for the face recognition of that person by gathering face data. Then he tells you that his name is Paulo. At this point your mind knows that the face data it just learned belongs to Paulo. Now your mind is trained and ready to do face recognition on Paulo's face. Next time when you will see Paulo or his face in a picture you will immediately recognize him. This is how face recognition work. The more you will meet Paulo, the more data your mind will collect about Paulo and especially his face and the better you will become at recognizing him.

Now the next question is how to code face recognition with OpenCV, after all this is the only reason why you are reading this article, right? OK then. You might say that our mind can do these things easily but to actually code them into a computer is difficult? Don't worry, it is not. Thanks to OpenCV, coding face recognition is as easier as it feels. The coding steps for face recognition are same as we discussed it in real life example above.

  • Training Data Gathering: Gather face data (face images in this case) of the persons you want to recognize
  • Training of Recognizer: Feed that face data (and respective names of each face) to the face recognizer so that it can learn.
  • Recognition: Feed new faces of the persons and see if the face recognizer you just trained recognizes them.

OpenCV comes equipped with built in face recognizer, all you have to do is feed it the face data. It's that simple and this how it will look once we are done coding it.

visualization

OpenCV Face Recognizers

OpenCV has three built in face recognizers and thanks to OpenCV's clean coding, you can use any of them by just changing a single line of code. Below are the names of those face recognizers and their OpenCV calls.

  1. EigenFaces Face Recognizer Recognizer - cv2.face.createEigenFaceRecognizer()
  2. FisherFaces Face Recognizer Recognizer - cv2.face.createFisherFaceRecognizer()
  3. Local Binary Patterns Histograms (LBPH) Face Recognizer - cv2.face.createLBPHFaceRecognizer()

We have got three face recognizers but do you know which one to use and when? Or which one is better? I guess not. So why not go through a brief summary of each, what you say? I am assuming you said yes :) So let's dive into the theory of each.

EigenFaces Face Recognizer

This algorithm considers the fact that not all parts of a face are equally important and equally useful. When you look at some one you recognize him/her by his distinct features like eyes, nose, cheeks, forehead and how they vary with respect to each other. So you are actually focusing on the areas of maximum change (mathematically speaking, this change is variance) of the face. For example, from eyes to nose there is a significant change and same is the case from nose to mouth. When you look at multiple faces you compare them by looking at these parts of the faces because these parts are the most useful and important components of a face. Important because they catch the maximum change among faces, change the helps you differentiate one face from the other. This is exactly how EigenFaces face recognizer works.

EigenFaces face recognizer looks at all the training images of all the persons as a whole and try to extract the components which are important and useful (the components that catch the maximum variance/change) and discards the rest of the components. This way it not only extracts the important components from the training data but also saves memory by discarding the less important components. These important components it extracts are called principal components. Below is an image showing the principal components extracted from a list of faces.

Principal Components eigenfaces_opencv source

You can see that principal components actually represent faces and these faces are called eigen faces and hence the name of the algorithm.

So this is how EigenFaces face recognizer trains itself (by extracting principal components). Remember, it also keeps a record of which principal component belongs to which person. One thing to note in above image is that Eigenfaces algorithm also considers illumination as an important component.

Later during recognition, when you feed a new image to the algorithm, it repeats the same process on that image as well. It extracts the principal component from that new image and compares that component with the list of components it stored during training and finds the component with the best match and returns the person label associated with that best match component.

Easy peasy, right? Next one is easier than this one.

FisherFaces Face Recognizer

This algorithm is an improved version of EigenFaces face recognizer. Eigenfaces face recognizer looks at all the training faces of all the persons at once and finds principal components from all of them combined. By capturing principal components from all the of them combined you are not focusing on the features that discriminate one person from the other but the features that represent all the persons in the training data as a whole.

This approach has drawbacks, for example, images with sharp changes (like light changes which is not a useful feature at all) may dominate the rest of the images and you may end up with features that are from external source like light and are not useful for discrimination at all. In the end, your principal components will represent light changes and not the actual face features.

Fisherfaces algorithm, instead of extracting useful features that represent all the faces of all the persons, it extracts useful features that discriminate one person from the others. This way features of one person do not dominate over the others and you have the features that discriminate one person from the others.

Below is an image of features extracted using Fisherfaces algorithm.

Fisher Faces eigenfaces_opencv source

You can see that features extracted actually represent faces and these faces are called fisher faces and hence the name of the algorithm.

One thing to note here is that even in Fisherfaces algorithm if multiple persons have images with sharp changes due to external sources like light they will dominate over other features and affect recognition accuracy.

Getting bored with this theory? Don't worry, only one face recognizer is left and then we will dive deep into the coding part.

Local Binary Patterns Histograms (LBPH) Face Recognizer

I wrote a detailed explaination on Local Binary Patterns Histograms in my previous article on face detection using local binary patterns histograms. So here I will just give a brief overview of how it works.

We know that Eigenfaces and Fisherfaces are both affected by light and in real life we can't guarantee perfect light conditions. LBPH face recognizer is an improvement to overcome this drawback.

Idea is to not look at the image as a whole instead find the local features of an image. LBPH alogrithm try to find the local structure of an image and it does that by comparing each pixel with its neighboring pixels.

Take a 3x3 window and move it one image, at each move (each local part of an image), compare the pixel at the center with its neighbor pixels. The neighbors with intensity value less than or equal to center pixel are denoted by 1 and others by 0. Then you read these 0/1 values under 3x3 window in a clockwise order and you will have a binary pattern like 11100011 and this pattern is local to some area of the image. You do this on whole image and you will have a list of local binary patterns.

LBP Labeling LBP labeling

Now you get why this algorithm has Local Binary Patterns in its name? Because you get a list of local binary patterns. Now you may be wondering, what about the histogram part of the LBPH? Well after you get a list of local binary patterns, you convert each binary pattern into a decimal number (as shown in above image) and then you make a histogram of all of those values. A sample histogram looks like this.

Sample Histogram LBP labeling

I guess this answers the question about histogram part. So in the end you will have one histogram for each face image in the training data set. That means if there were 100 images in training data set then LBPH will extract 100 histograms after training and store them for later recognition. Remember, algorithm also keeps track of which histogram belongs to which person.

Later during recognition, when you will feed a new image to the recognizer for recognition it will generate a histogram for that new image, compare that histogram with the histograms it already has, find the best match histogram and return the person label associated with that best match histogram. 

Below is a list of faces and their respective local binary patterns images. You can see that the LBP images are not affected by changes in light conditions.

LBP Faces LBP faces source

The theory part is over and now comes the coding part! Ready to dive into coding? Let's get into it then.

Coding Face Recognition with OpenCV

The Face Recognition process in this tutorial is divided into three steps.

  1. Prepare training data: In this step we will read training images for each person/subject along with their labels, detect faces from each image and assign each detected face an integer label of the person it belongs to.
  2. Train Face Recognizer: In this step we will train OpenCV's LBPH face recognizer by feeding it the data we prepared in step 1.
  3. Testing: In this step we will pass some test images to face recognizer and see if it predicts them correctly.

[There should be a visualization diagram for above steps here]

To detect faces, I will use the code from my previous article on face detection. So if you have not read it, I encourage you to do so to understand how face detection works and its Python coding.

Import Required Modules

Before starting the actual coding we need to import the required modules for coding. So let's import them first.

  • cv2: is OpenCV module for Python which we will use for face detection and face recognition.
  • os: We will use this Python module to read our training directories and file names.
  • numpy: We will use this module to convert Python lists to numpy arrays as OpenCV face recognizers accept numpy arrays.
#import OpenCV module
import cv2
#import os module for reading training data directories and paths
import os
#import numpy to convert python lists to numpy arrays as 
#it is needed by OpenCV face recognizers
import numpy as np

#matplotlib for display our images
import matplotlib.pyplot as plt
%matplotlib inline 

Training Data

The more images used in training the better. Normally a lot of images are used for training a face recognizer so that it can learn different looks of the same person, for example with glasses, without glasses, laughing, sad, happy, crying, with beard, without beard etc. To keep our tutorial simple we are going to use only 12 images for each person.

So our training data consists of total 2 persons with 12 images of each person. All training data is inside training-data folder. training-data folder contains one folder for each person and each folder is named with format sLabel (e.g. s1, s2) where label is actually the integer label assigned to that person. For example folder named s1 means that this folder contains images for person 1. The directory structure tree for training data is as follows:

training-data
|-------------- s1
|               |-- 1.jpg
|               |-- ...
|               |-- 12.jpg
|-------------- s2
|               |-- 1.jpg
|               |-- ...
|               |-- 12.jpg

The test-data folder contains images that we will use to test our face recognizer after it has been successfully trained.

As OpenCV face recognizer accepts labels as integers so we need to define a mapping between integer labels and persons actual names so below I am defining a mapping of persons integer labels and their respective names.

Note: As we have not assigned label 0 to any person so the mapping for label 0 is empty.

#there is no label 0 in our training data so subject name for index/label 0 is empty
subjects = ["", "Tom Cruise", "Shahrukh Khan"]

Prepare training data

You may be wondering why data preparation, right? Well, OpenCV face recognizer accepts data in a specific format. It accepts two vectors, one vector is of faces of all the persons and the second vector is of integer labels for each face so that when processing a face the face recognizer knows which person that particular face belongs too.

For example, if we had 2 persons and 2 images for each person.

PERSON-1    PERSON-2   

img1        img1         
img2        img2

Then the prepare data step will produce following face and label vectors.

FACES                        LABELS

person1_img1_face              1
person1_img2_face              1
person2_img1_face              2
person2_img2_face              2

Preparing data step can be further divided into following sub-steps.

  1. Read all the folder names of subjects/persons provided in training data folder. So for example, in this tutorial we have folder names: s1, s2.
  2. For each subject, extract label number. Do you remember that our folders have a special naming convention? Folder names follow the format sLabel where Label is an integer representing the label we have assigned to that subject. So for example, folder name s1 means that the subject has label 1, s2 means subject label is 2 and so on. The label extracted in this step is assigned to each face detected in the next step.
  3. Read all the images of the subject, detect face from each image.
  4. Add each face to faces vector with corresponding subject label (extracted in above step) added to labels vector.

[There should be a visualization for above steps here]

Did you read my last article on face detection? No? Then you better do so right now because to detect faces, I am going to use the code from my previous article on face detection. So if you have not read it, I encourage you to do so to understand how face detection works and its coding. Below is the same code.

#function to detect face using OpenCV
def detect_face(img):
    #convert the test image to gray image as opencv face detector expects gray images
    gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
    
    #load OpenCV face detector, I am using LBP which is fast
    #there is also a more accurate but slow Haar classifier
    face_cascade = cv2.CascadeClassifier('opencv-files/lbpcascade_frontalface.xml')

    #let's detect multiscale (some images may be closer to camera than others) images
    #result is a list of faces
    faces = face_cascade.detectMultiScale(gray, scaleFactor=1.2, minNeighbors=5);
    
    #if no faces are detected then return original img
    if (len(faces) == 0):
        return None, None
    
    #under the assumption that there will be only one face,
    #extract the face area
    (x, y, w, h) = faces[0]
    
    #return only the face part of the image
    return gray[y:y+w, x:x+h], faces[0]

I am using OpenCV's LBP face detector. On line 4, I convert the image to grayscale because most operations in OpenCV are performed in gray scale, then on line 8 I load LBP face detector using cv2.CascadeClassifier class. After that on line 12 I use cv2.CascadeClassifier class' detectMultiScale method to detect all the faces in the image. on line 20, from detected faces I only pick the first face because in one image there will be only one face (under the assumption that there will be only one prominent face). As faces returned by detectMultiScale method are actually rectangles (x, y, width, height) and not actual faces images so we have to extract face image area from the main image. So on line 23 I extract face area from gray image and return both the face image area and face rectangle.

Now you have got a face detector and you know the 4 steps to prepare the data, so are you ready to code the prepare data step? Yes? So let's do it.

#this function will read all persons' training images, detect face from each image
#and will return two lists of exactly same size, one list 
# of faces and another list of labels for each face
def prepare_training_data(data_folder_path):
    
    #------STEP-1--------
    #get the directories (one directory for each subject) in data folder
    dirs = os.listdir(data_folder_path)
    
    #list to hold all subject faces
    faces = []
    #list to hold labels for all subjects
    labels = []
    
    #let's go through each directory and read images within it
    for dir_name in dirs:
        
        #our subject directories start with letter 's' so
        #ignore any non-relevant directories if any
        if not dir_name.startswith("s"):
            continue;
            
        #------STEP-2--------
        #extract label number of subject from dir_name
        #format of dir name = slabel
        #, so removing letter 's' from dir_name will give us label
        label = int(dir_name.replace("s", ""))
        
        #build path of directory containin images for current subject subject
        #sample subject_dir_path = "training-data/s1"
        subject_dir_path = data_folder_path + "/" + dir_name
        
        #get the images names that are inside the given subject directory
        subject_images_names = os.listdir(subject_dir_path)
        
        #------STEP-3--------
        #go through each image name, read image, 
        #detect face and add face to list of faces
        for image_name in subject_images_names:
            
            #ignore system files like .DS_Store
            if image_name.startswith("."):
                continue;
            
            #build image path
            #sample image path = training-data/s1/1.pgm
            image_path = subject_dir_path + "/" + image_name

            #read image
            image = cv2.imread(image_path)
            
            #display an image window to show the image 
            cv2.imshow("Training on image...", image)
            cv2.waitKey(100)
            
            #detect face
            face, rect = detect_face(image)
            
            #------STEP-4--------
            #for the purpose of this tutorial
            #we will ignore faces that are not detected
            if face is not None:
                #add face to list of faces
                faces.append(face)
                #add label for this face
                labels.append(label)
            
    cv2.destroyAllWindows()
    cv2.waitKey(1)
    cv2.destroyAllWindows()
    
    return faces, labels

I have defined a function that takes the path, where training subjects' folders are stored, as parameter. This function follows the same 4 prepare data substeps mentioned above.

(step-1) On line 8 I am using os.listdir method to read names of all folders stored on path passed to function as parameter. On line 10-13 I am defining labels and faces vectors.

(step-2) After that I traverse through all subjects' folder names and from each subject's folder name on line 27 I am extracting the label information. As folder names follow the sLabel naming convention so removing the letter s from folder name will give us the label assigned to that subject.

(step-3) On line 34, I read all the images names of of the current subject being traversed and on line 39-66 I traverse those images one by one. On line 53-54 I am using OpenCV's imshow(window_title, image) along with OpenCV's waitKey(interval) method to display the current image being traveresed. The waitKey(interval) method pauses the code flow for the given interval (milliseconds), I am using it with 100ms interval so that we can view the image window for 100ms. On line 57, I detect face from the current image being traversed.

(step-4) On line 62-66, I add the detected face and label to their respective vectors.

But a function can't do anything unless we call it on some data that it has to prepare, right? Don't worry, I have got data of two beautiful and famous celebrities. I am sure you will recognize them!

training-data

Let's call this function on images of these beautiful celebrities to prepare data for training of our Face Recognizer. Below is a simple code to do that.

#let's first prepare our training data
#data will be in two lists of same size
#one list will contain all the faces
#and other list will contain respective labels for each face
print("Preparing data...")
faces, labels = prepare_training_data("training-data")
print("Data prepared")

#print total faces and labels
print("Total faces: ", len(faces))
print("Total labels: ", len(labels))
Preparing data...
Data prepared
Total faces:  23
Total labels:  23

This was probably the boring part, right? Don't worry, the fun stuff is coming up next. It's time to train our own face recognizer so that once trained it can recognize new faces of the persons it was trained on. Read? Ok then let's train our face recognizer.

Train Face Recognizer

As we know, OpenCV comes equipped with three face recognizers.

  1. EigenFace Recognizer: This can be created with cv2.face.createEigenFaceRecognizer()
  2. FisherFace Recognizer: This can be created with cv2.face.createFisherFaceRecognizer()
  3. Local Binary Patterns Histogram (LBPH): This can be created with cv2.face.LBPHFisherFaceRecognizer()

I am going to use LBPH face recognizer but you can use any face recognizer of your choice. No matter which of the OpenCV's face recognizer you use the code will remain the same. You just have to change one line, the face recognizer initialization line given below.

#create our LBPH face recognizer 
face_recognizer = cv2.face.createLBPHFaceRecognizer()

#or use EigenFaceRecognizer by replacing above line with 
#face_recognizer = cv2.face.createEigenFaceRecognizer()

#or use FisherFaceRecognizer by replacing above line with 
#face_recognizer = cv2.face.createFisherFaceRecognizer()

Now that we have initialized our face recognizer and we also have prepared our training data, it's time to train the face recognizer. We will do that by calling the train(faces-vector, labels-vector) method of face recognizer.

#train our face recognizer of our training faces
face_recognizer.train(faces, np.array(labels))

Did you notice that instead of passing labels vector directly to face recognizer I am first converting it to numpy array? This is because OpenCV expects labels vector to be a numpy array.

Still not satisfied? Want to see some action? Next step is the real action, I promise!

Prediction

Now comes my favorite part, the prediction part. This is where we actually get to see if our algorithm is actually recognizing our trained subjects's faces or not. We will take two test images of our celeberities, detect faces from each of them and then pass those faces to our trained face recognizer to see if it recognizes them.

Below are some utility functions that we will use for drawing bounding box (rectangle) around face and putting celeberity name near the face bounding box.

#function to draw rectangle on image 
#according to given (x, y) coordinates and 
#given width and heigh
def draw_rectangle(img, rect):
    (x, y, w, h) = rect
    cv2.rectangle(img, (x, y), (x+w, y+h), (0, 255, 0), 2)
    
#function to draw text on give image starting from
#passed (x, y) coordinates. 
def draw_text(img, text, x, y):
    cv2.putText(img, text, (x, y), cv2.FONT_HERSHEY_PLAIN, 1.5, (0, 255, 0), 2)

First function draw_rectangle draws a rectangle on image based on passed rectangle coordinates. It uses OpenCV's built in function cv2.rectangle(img, topLeftPoint, bottomRightPoint, rgbColor, lineWidth) to draw rectangle. We will use it to draw a rectangle around the face detected in test image.

Second function draw_text uses OpenCV's built in function cv2.putText(img, text, startPoint, font, fontSize, rgbColor, lineWidth) to draw text on image.

Now that we have the drawing functions, we just need to call the face recognizer's predict(face) method to test our face recognizer on test images. Following function does the prediction for us.

#this function recognizes the person in image passed
#and draws a rectangle around detected face with name of the 
#subject
def predict(test_img):
    #make a copy of the image as we don't want to chang original image
    img = test_img.copy()
    #detect face from the image
    face, rect = detect_face(img)

    #predict the image using our face recognizer 
    label= face_recognizer.predict(face)
    #get name of respective label returned by face recognizer
    label_text = subjects[label]
    
    #draw a rectangle around face detected
    draw_rectangle(img, rect)
    #draw name of predicted person
    draw_text(img, label_text, rect[0], rect[1]-5)
    
    return img
  • line-6 read the test image
  • line-7 detect face from test image
  • line-11 recognize the face by calling face recognizer's predict(face) method. This method will return a lable
  • line-12 get the name associated with the label
  • line-16 draw rectangle around the detected face
  • line-18 draw name of predicted subject above face rectangle

Now that we have the prediction function well defined, next step is to actually call this function on our test images and display those test images to see if our face recognizer correctly recognized them. So let's do it. This is what we have been waiting for.

print("Predicting images...")

#load test images
test_img1 = cv2.imread("test-data/test1.jpg")
test_img2 = cv2.imread("test-data/test2.jpg")

#perform a prediction
predicted_img1 = predict(test_img1)
predicted_img2 = predict(test_img2)
print("Prediction complete")

#create a figure of 2 plots (one for each test image)
f, (ax1, ax2) = plt.subplots(1, 2, figsize=(10, 5))

#display test image1 result
ax1.imshow(cv2.cvtColor(predicted_img1, cv2.COLOR_BGR2RGB))

#display test image2 result
ax2.imshow(cv2.cvtColor(predicted_img2, cv2.COLOR_BGR2RGB))

#display both images
cv2.imshow("Tom cruise test", predicted_img1)
cv2.imshow("Shahrukh Khan test", predicted_img2)
cv2.waitKey(0)
cv2.destroyAllWindows()
cv2.waitKey(1)
cv2.destroyAllWindows()
Predicting images...
Prediction complete

wohooo! Is'nt it beautiful? Indeed, it is!

End Notes

Face Recognition is a fascinating idea to work on and OpenCV has made it extremely simple and easy for us to code it. It just takes a few lines of code to have a fully working face recognition application and we can switch between all three face recognizers with a single line of code change. It's that simple.

Although EigenFaces, FisherFaces and LBPH face recognizers are good but there are even better ways to perform face recognition like using Histogram of Oriented Gradients (HOGs) and Neural Networks. So the more advanced face recognition algorithms are now a days implemented using a combination of OpenCV and Machine learning. I have plans to write some articles on those more advanced methods as well, so stay tuned!

Download Details:
Author: informramiz
Source Code: https://github.com/informramiz/opencv-face-recognition-python
License: MIT License

#opencv  #python #facerecognition 

Maddy Bris

Maddy Bris

1599132316

5Kw Solar System in Brisbane

1 August 2020, Sunny Sky solarannounced you to launch a residential solar power system in Queensland, Australia. There are different sizes of houses with different energy requirements so one solar power system cannot fulfill every type of electricity need.

Whether energy need is low or higher they have announced a wide range of solar power system in Brisbane that includes 5KW solar panel system, 6Kw solar panel system, 10Kw solar panel system, and many more so that everyone can enjoy the benefits of solar energy.

Residential Solar Power System needs to be flexible because of the changing requirement of energy. As we know our energy needs hikes up in the summers more than winters because we use air conditioners, refrigerators (also used in winters but less than summers), fans. In winter we drop down these usages so the energy needs to go up and down according to the weather changing.

Some households have a high energy need, some have low, and mostly have the normal or average of high and low. Sunny Sky Solar offers expert’s advice to all the customers on call or personally because it is important to analyze the energy need, budget, location, and many other things before buying a solar power system for your home sweet home.

Their professionals analyze all these things and suggest you the best residential solar power system in Brisbane to reduce the energy costs and clean the environment as solar energy is green & clean energy.

At this time of announcing the residential solar panel system, the representative of Sunny Sky Solar has talked about some advantages of a residential solar power system. He said “get update yourself by the time is important because the latest technology will save you lots of money and time. The solar power system is the best technology in this era that can give you lots of benefits. Don’t get upset with the initial cost because after installing a solar power system at your house it will repay you the initial cost in two to three years. So, you are going to invest in a great deal if you are purchasing a solar panel system in Brisbane.”

He also added “Residential solar power system can save your pocket from getting loose every month for heavy electricity bills. You will earn money by producing solar energy and feeding your power supply grid as government, and mostly all the power suppliers give benefits to producing solar energy. You can easily earn money by feeding the power grid with your excess produced solar energy. You will use solar energy and save the excess by feeding the power grid this way.”

Sunny Sky Solar offering an efficient range of residential and commercial solar power system that includes 5KW solar panel system, 6.6Kw solar panel system, 10Kw solar panel system, and there are many more that you can select according to your energy needs and budget.
They provide expert assistance that will help you in choosing the best solar system for your house. Their experienced professionals work under the guidance of experts who ensures the perfections and safety at the time of installing and after the installation.

Installing a solar power system at your place will be more convenient with them because they work under the expert’s supervision that makes them perfect and faster. They ensure safety first at the time of installing because at that time family members are around the installing site and accidents can happen.

They also ensure the quality of products they used in installing and other solar products. If the products will be durable and efficient, the system will produce more electricity with higher efficiency for a longer period.
The main thing that matters while installing a solar power system at a residence is the roof situation, Sunny Sky Solar doesn’t work for doing business only. They first check the place or analyze from your information that your location is safe for installing a solar power system or not. If the find any problem they will suggest repairing it first because if you will put the solar power system at a less secure place and the solar system’s weight can damage it then repairing that place first should your main priority.
This shows their loyalty and caring behavior towards the customers.

#solar panel system #solar panel system in brisbane #5kw solar panel system #5kw solar panel system #10kw solar panel system #10kw solar panel system in brisbane

Secret Email System Review - Recommended or Not?

Matt Bacak’s secret email system is one of the most successful products in the WarriorPlus marketplace in recent memory. My secret email system review will not try to hard sell you on the product – I mean, it’s pretty cheap, so if you’re going to buy it, you’re going to buy it. Instead, I’ll concentrate on explaining the benefits of email marketing and how to get the most out of Matt’s system.

Nowadays, digital marketing is essential for every business. But what is the best strategy? There are many different points of view, but one thing is certain: emails are essential. Email marketing is one of the most efficient and cost-effective ways to promote a business online, and it is simple and inexpensive to get started. The most important thing is to understand your audience and deliver content and offers that are truly relevant to them.

The PDF Download of an Honest Secret Email System Review
The front-end product
What Matt Bacak is selling, which has been promoted by such capable affiliates as Curt Maly, is a PDF ebook that you can download immediately after purchasing. However, there are a number of bonuses included to sweeten the deal. You get access to Mr. Bacak’s private Facebook group, and instead of a simple PDF download, you get a massive zip file full of useful files and videos.
Now that we know what we’re up against, let’s get into this secret email system review!

What is Included in the Secret Email System Download?
Here is a list of everything you get inside the zip file sold at the front end of the Secret Email System:

Matt Bacak’s 3x Formula Calculator (plus a video explaining how to use it)
1000 email swipe files in text format (swipe files or “swipes” are like templates you can repurpose in a variety of ways).
A 1.5-hour video session

Free access to Matt’s high-converting leadpages lead generation template
A massive book of swipe files (in PDF format)
A copy of Matt’s book, Secrets of the Internet Millionaire Mind,
A video tutorial on how to select “irresistible offers” from affiliate marketplaces.

The PDF version of The Secret Email System
The Checklist for the Secret Email System PDF
Text files containing instructions for joining the Facebook group and other bonuses
Matt was charging less than $6 for all of that value last time I checked. He is demonstrating his many years of experience in internet marketing by creating an irresistible offer that people will want to buy and affiliates will want to promote. As a result, the Secret Email System has sold more copies on Warrior Plus than any other product in recent memory.

Examine everything included in the secret email system
Who is Matt Bacak, and why should I listen to him?
Many consider Matt Bacak to be an internet marketing legend, and email marketing is his primary focus. My first encounter with Matt came in the form of some Facebook ads he ran. Matt explained who he was in the video ad (which featured a little guy dancing in the background) and invited me to visit his blog, which I did. He demonstrated a thorough understanding of online business, so it’s no surprise that he put together the ultimate email marketing package.
headshot of Matt Bacak

Overall, Matt’s ad was one of the strangest Facebook ads I’ve ever seen. It was also one of the most effective and memorable. I didn’t buy whatever Matt was selling that day, but I read his blog and remembered his name and who he was. When I saw Curt Maly running ads for Matt Bacak’s Secret Email System months later, it made a big difference.

When I saw that the price was under $6 and that the bonuses were included, I knew I had to buy the product. I didn’t buy it right away because I was too busy, but it stayed in the back of my mind until I had the opportunity to do so.
If it isn’t obvious, I’ll explain: the reason you should listen to Matt Bacak is that he knows how to get inside people’s heads and stay there, both as a marketer and as a public figure.

Is the Secret Email System Training of Good Quality?
At first glance, the training does not appear to be groundbreaking, but this is because the creator is unconcerned about flashy packaging. You literally get a zip file full of stuff that most people would put on a membership website. I can see how this would irritate some people who are used to flashy ClickFunnels and Kajabi courses.

If that describes you, you’re missing out. Matt’s training isn’t flashy, but it describes a solid system that most businesses can implement in some way. As the name implies, it all revolves around building a list and emailing it on a regular basis. Did I ruin the surprise?
Front end offer and upsells from a secret email system
Bonuses from the Secret Email System (and a Bonus From Me)
I’ve already outlined everything you get in the zip file that serves as the funnel’s front-end offer. Everything else, other than the Secret Email System PDF itself, is considered a bonus, and the total value could easily be in the hundreds of dollars.

That’s why purchasing this product was such a no-brainer for me. I already knew how to write good marketing emails, but I really wanted to look inside Matt’s system.
In addition to everything else, you’ll get lifetime access to Matt’s private Facebook community. He answers questions from people here on a daily basis, and it can be a great place to learn.

The truth is that you get so much value and stuff from purchasing this product that adding another bonus is almost pointless. But I’m a bonus machine, so be prepared.
In 2020, I published my first book on email marketing, How to Build Your First Money Making Email List. You’re already getting a lot of reading material, but if you purchase Matt’s product through my link, I’ll add it to the stack. Most of the books I write sell for $27, so this just adds to the ridiculous valuation of this sub-six-dollar product.
Bonuses Bonuses for Matt Bacak’s Secret Email System
Will This Product Really Help You Make Money Online?

It all depends on whether or not you use the secret email system. According to multiple sources, Matt Bacak is in charge of millions of dollars in sales for both himself and his clients. And the best thing about this guy is that he’s upfront and honest, and he puts his money where his mouth is. What I mean is that he doesn’t hold anything back in the books he writes. That is another reason he has amassed such a large and devoted fan base.

Finally, if your business can profit from email marketing or if you want to use email marketing to become an influential public figure, I believe this ebook can assist you. It helped me improve my understanding of the business side of being an affiliate marketer and is far more valuable than the price tag. This product will be especially useful if you want to get started in affiliate marketing with a small investment.

matt bacak’s business model
Going Beyond My Review – Secret Email System
The book itself goes beyond email marketing, but I don’t want to give too much away. Instead, I’ll go over some of the finer points of lead generation quickly so you can get started building your email list as soon as possible.

Now, I’m guessing that roughly 90% of people reading this review are affiliate marketers or are interested in affiliate marketing. As a result, I’m going to focus on lead generation strategies used by many successful affiliates. If you want to learn more about my favorite affiliate marketing strategies, click on that link to read my in-depth guide.

The Most Effective Methods for Building an Email List
Here’s a rundown of some of the best (and quickest) ways to build an email list. First, you’ll need a way to collect emails, and it must be a high-converting method. My favorite lead generation tools are:
ConvertBox (on-site messaging software/advanced popup builder)
ConversioBot (website chatbot platform)

You may have noticed that the majority of them are chatbots. Chatbots, on the other hand, are one of the best ways to not only capture an email address, but also to obtain additional customer information and even directly sell products.
The following are the most effective ways to drive traffic to these tools:
Facebook ads (particularly effective when paired with ConvertBox)
Google Ads and YouTube Ads (a killer combination with ConvertBox or Conversiobot)

Influencer Marketing
Facebook organic marketing
Search Engine Optimization
Secret Email System sales page Matt Bacak

If you can master even one of those traffic methods and use it to drive people to a high-converting optin or sales funnel, you’ll be well on your way to creating a recurring income.
Whether or not you choose to purchase this product through my link, I wish you the best of luck with your online business. If you do purchase the system, I hope to see you in the Facebook community! Please feel free to contact me via message or email at any time.

And if you do get the ebook through my link, please let me know so I can send you a copy of my book as a bonus!

Frequently Asked Questions (FAQs) About The Secret Email System
Here are some frequently asked product-related questions.
Is the secret email system bonus worth it?

In my opinion, the front end product and the majority of the bonuses are worth the price. I would have paid more just to gain access to Matt’s Facebook group!
What are the benefits of a hidden email system?
The main benefit is that you will learn one of the highest ROI business practices (email marketing) from someone who has built a seven-figure online business.

What do you call email marketing?
Email marketing is an important component of digital marketing for many businesses. Email marketing software is frequently referred to as an autoresponder, but a good email marketing platform will have more functionality.

Is this a legitimate way to make money online?
My secret email system review says it’s a great way to make money online as long as your online business uses marketing emails. It does require a list, but Matt teaches several methods for creating one.

Visit The Officail Website

#secret email system matt bacak #secret email system review #secret email system #secret email system bonus #secret email system bonuses #secret email system reviews

Super Affiliate System Review - Recommended or Not?

Is it worth your money?

John Crestani created the Super Affiliate System, an ideal program to equip people with information and skills to achieve affiliate marketing success. In this system, learners need to participate in a module-based learning setting that will help them get started with affiliate marketing by using a simplified system that consists of a single website, buyers, and regular quality traffic. Go through the super affiliate system review to find out more!

John Crestanis’s extensive knowledge and skills in this industry set the Super Affiliate System far apart from competitor affiliate marketing systems. But is the Super Affiliate Commission System a genuine deal? Is it worth investing in? Today, in this Super Affiliate System review, we will take a look at what the system requires and decide whether it’s a real deal affiliate marketing enthusiasts should invest in.

What is the Super Affiliate System?

This is a complete training course that assists people in becoming successful affiliate marketers. The guide uses videos to lead you through the tools and processes you need to become a super affiliate marketer. The program creator has shared thriving, in-depth strategies to give you a life of freedom if you pay heed to them.

The Super Affiliate System is a training guide to equip you with knowledge and skills in the industry. The system will also allow a list of tools needed for affiliate marketers to fast-track their potential.

Super Affiliate System Review: Pros and Cons

There are a few pros and cons that will enlighten beginner affiliates on whether to consider this system or not. Let’s have a look at them one by one:
Pros:-

The system has extensive and informative, easy to follow modules.

The system is designed in a user-friendly manner, especially for beginners.

Equipped with video tutorials to quickly guide you through the process.

The system gives affiliates niche information to provide them with a competitive advantage.

Equipped with revision sections, weekly questions, and daily assignments to help you grasp all the course ideas.

The system extends clients to a 24/7 support system.

It allows clients to have monthly payment plans that can be suitable for those who can’t bear the price of a single down payment. It offers

clients a lot of bonuses.

Clients are allowed a 60-day Super Affiliate System refund guarantee.

Cons:-

It’s very expensive.

Limited coverage of affiliate networks and niches.

Who created the Super Affiliate System?

John Crestani, a 29-year-old expert in affiliate marketing from Santa Monica, California, is the program’s creator. The veteran left out of college and chose to earn money online since there are low job prospects. He failed several times, striving to make ends meet for quite some time until he successfully built a successful affiliate site dealing with health-related products.
He is currently a seven-figure person making more than $500 per month. His remarkable success in affiliate marketing has made him a featured in Yahoo Finance, Inc., Forbes, Business Insider, and Home Business magazine.

With the enormous success he has seen in affiliate marketing, John has designed an easy-to-follow guide to provide people with the skills to make money as an affiliate marketer. He has described all the strategies and tools he used to lead him to success.

Super Affiliate System Review: Does it Work?

The system accommodates affiliate marketers with in-depth details on how to develop successful affiliate networks. The Super Affiliate System review has a positive impact on different affiliate marketers who have tried it and noticed impressive results. But then, does it work?

The program doesn’t promise you overnight riches; it demands work and application to perform it. After finishing the Super Affiliate System online video training course, attaining success requires you to put John’s strategies into practice. A lot of commitment, hard work, and time are required in order to become a successful affiliate marketer.

How Does It Work?

As its name suggests, the Super Affiliate System is there to make you a super affiliate. John himself is an experienced affiliate, and he has accumulated all the necessary tools to achieve success in training others to become super affiliates. The Super Affiliate Network System members’ area has outlined everything that the veteran affiliate used to make millions as an affiliate.
The guide will help you set up campaigns, traffic resources, essential tools you need as an affiliate, and the veteran affiliate networks to achieve success.

Most amateur affiliates usually get frustrated as they might demand time to start making money. Those who succeed in getting little coins mainly do the following to earn;

They first become Super Affiliate System affiliates.

They promote the Super Affiliate System in multiple ways.

They convert the marketing leads they get into sales.

They receive a commission on every sale they make.

Affiliate marketing involves trading other people’s products and earning commissions from the sales you make. It’s an online business that can be done either with free or paid traffic. With the Super Affiliate System, one of the basic teachings you’ll get in the guide is how to make money by promoting the course itself using paid traffic Facebook ads.

What’s in the Super Affiliate System?

The system is amongst the most comprehensive affiliate marketing courses on the market. The Super Affiliate System comprises more than 50 hours of content that takes about six weeks to complete. The Super Affiliate System also includes several video lectures and tutorials alongside several questions and homework assignments to test its retention.

What Does the Super Affiliate Program Cover?

This program aims to provide affiliates with comprehensive ideas and tactics to become successful affiliate marketers. Therefore, their online video training course is comprehensive. Below are areas of information included within the modules;

Facebook ads

Native ads

Website creation

Google ads

Social ads

Niche selection

YouTube ads

Content creation

Scaling

Tracking and testing

Affiliate networks

Click funnels

Advanced strategies

Besides the extensive information the creator has presented on these topics, he also went an extra mile to review the complete material and also guide marketers through the course.

Who is the Super Affiliate System for?

There are a number of digital products out there that provide solutions to techniques to earn money online. But not all options offer real value for what you want. John gives people a Super Affiliate System free webinar to allow them to learn what the system entails. It will help if you spare time to watch it, as it takes 90 minutes to get through. 
Below is a brief guide to who this system is for:

  1. It is for beginners who can equip themselves with appropriate affiliate marketing skills. People who are still employed and want to have an alternative earning scheme fit here.

  2. The system is also suitable for entrepreneurs who need to learn to earn money online, mainly using paid ads.

  3. The Super Affiliate System also suits anyone who is looking for another alternative stream of income.

Making money online has many advantages at large. You have the flexibility to work from any place, in the comfort of your home, with just an internet connection. Even though John has stated that there are no special skills needed to achieve success in affiliate marketing, there are little basics necessary to keep you on track. 
Having a proper mindset is also vital to attaining success in affiliate marketing. So, affiliates who believe in the system working for them need to be dedicated, focused, and committed. 
They incorporate;

Keep in mind that you have more than $895 in advertisements to get started. Furthermore, set aside a couple of dollars so that you keep on the right track.
There is also additional software you require to get started. It needs an extra of between $80 and $100 a month to get it.

Where to Buy a Super Affiliate System?

If you are interested in joining this big team, you have to get into the Super Affiliate System on the official website, superaffiliatesystem.org, and get it from there. You have to pay their set fees to get their courses and other new materials within their learning scope.

Super Affiliate System Review: Is it Worth the Money?

It depends on an individual whether the system is worth it or not. The system is worth the money for serious people who want to go deep into an affiliate marketing career and have the time to put the Super Affiliate System strategies into practice. Super Affiliate System Review, Is it worth your money?
But people who also look forward to becoming rich overnight need to get off as this is not your way. Hard work and commitment are paramount to getting everything that works best for you.

**Visit The Officail Website

#super affiliate system review #super affiliate system #super affiliate system 3 #super affiliate system 3.0 review #super affiliate system pro #super affiliate system john crestani