Posts

Deep Learning Face recognition: Part 1

What is Face Recognition? It is an ability to recognize a face of a person in an image. In early days operator has to manually tag the location of each facial features. The new complex statistical model was built and used to increase the accuracy of recognition. The advent of deep learning led to huge advances in face recognition. Researchers openly shared their solution for building face recognition. Uses of Face Recognition? Identify verification. Automatically organizing raw photo libraries by the person. Tracking a specific person. Counting unique people. Finding people with similar appearances. Tools for Face Recognition: Commercial face recognition services Amazon Rekognition API:  used for FACE RECOGNITION, EMOTION DETECTION, MOTION DETECTION Microsoft Azure Face API : used for FACE RECOGNITION, AGE AND GENDER DETECTION, AND FACE SIMILARITY MATCHING. Open source face recognition: OpenFace: Brandon Amos and Carnegie Mellon university dlib: Davis Ki

Deep Learning Face Recognition: Part 2

Image
Before reading this, please read  deep-learning-face-recognition-part-1.html  for better understanding What is Face Detection? ( locate and extract faces from each image.) The ability to detect and locate human faces in a photograph. Face detection is used for various purposes but here we use it for the only extraction of faces and pass it to the next level of face recognition. (face detection is one of the steps in our pipeline) Easiest Way to detect face is applying Sliding Window Classifier, It is done in two steps: Build a face detection model using a machine learning model which can tell whether a given image is a face or not. Slide the face detector across the large image for faces. If faces are detected it will note the location of it. Popular face detection algorithms:(Accuracy of detection increase from 1 to 3) viola jones Invented by Paul Viola and Michael Jones in the early 2000s. Uses decision trees to detect faces based on light and dark areas. Very fast

install keras with TensorFlow backend

As i am working on windows and familiar with it, i will explain how to install keras with TensorFlow cpu. Install anaconda by downloading(just clicking next, next...install). Open anaconda prompt and type following command to create an environment and activate it.(keras is the environment name of mine) >>conda create --name keras It will prompt for yes or no : type yes. For activating the Environment,Type following: >>conda activate keras Follow the link in-case you got struck somewhere:  https://docs.conda.io/projects/conda/en/latest/user-guide/tasks/manage-environments.html#activating-an-environment If you reopen the anaconda prompt after closing, it will open with it's default base environment. So to change the environment use activate command as above If needed check these: (keras) C:\Users\saicharan>conda info active environment : keras active env location : E:\anaconda3\envs\keras shell level : 2 user config file

Windows Startup errors and 0x0000225 Error

Image
My main motto is to repair the windows with my data saved. literally, I have tried the possible to solve the above error but I couldn't at initial phases. I have opened cmd from troubleshooting option->advanced option->cmd(you can come to troubleshooting option by pressing  F1  or F8 button simultaneously with the power button). you can check by pressing F2 with power(boot manager and system check) and F12  button (one-time boot menu). after entering cmd typed  bootrec /rebuildbcd, The  bootrec  command will search for Windows installations not included in the BCD and then ask you if you'd like to add one or more to it. then you may get a result of either installation 0 or 1  if 1 press yes to add and  Since the BCD store exists and lists a Windows installation, you'll first have to remove it manually and then try to rebuild it again. At the prompt, execute the  bcdedit  command as shown and then press  Enter :    bcdedit /export c:\bcdbac k if 0 the

Normalization

Major tasks of preprocessing are: Data cleaning filling missing values smoothing of noisy data identifying and removing outliers resolving inconsistencies Data Integration integrating data from multiple databases, data file, cubes Data transformation normalization  aggregation Data reduction obtain a reduced representation of data but same results Data discretization part of data reduction but with particular importance, especially for numeric data Normalization :  The goal of normalization is to make an entire set of values have a particular property. There are 3 different ways to perform normalization : min-max normalization X_std = (X - X.min(axis=0)) / (X.max(axis=0) - X.min(axis=0)) X_scaled = X_std * (max - min) + min here max, min is the new ranges  z-score normalization z = (x - u) / s where u is the mean of the training samples, s is the standard deviation normalization by decimal scaling v_new = v/pow(10,j) here j is th

How to Handle Noisy Data in preprocessing of data?

Binning method:(one of the method) first sort data and partition into (equi-depth) bins then one can smooth by bin means,  smooth by bin median, smooth by bin boundaries, etc. Equal-width (distance) partitioning: It divides the range into N intervals of equal size: uniform grid if A and B are the lowest and highest values of the attribute, the width of intervals will be: W = (B-A)/N. The most straightforward But outliers may dominate the presentation Skewed data is not handled well. Equal-depth (frequency) partitioning: It divides the range into N intervals, each containing approximately same number of samples Good data scaling Managing categorical attributes can be tricky. Code for binning (if needed we can edit for user input instead of random) : Feel free to comment about mistakes and doubts.

Roots of a Polynomial Equation

The  solvers  module in SymPy implements methods for solving equations. Let's take an example of solving the equation of order 2. Equation : (x - 0.4)*(x + 0.65) - 1, Now we try to find positive roots of equation from sympy.solvers import solve from sympy import Symbol beta = Symbol('x',positive=True) #https://docs.sympy.org/latest/modules/solvers/solvers.html f =1 gammavalues = [0.4, 0.35, 0.3] for i in range(1,-1,-1): f = f*(beta-gammavalues[i]) f= f+1 f = f-2 print(f) beta = solve(f, beta) print(beta) output: (x - 0.4)*(x + 0.65) - 1 [1.00443569980765] just go through this link where you can find other important things like solving an algebraic equation, ODEs, PDEs https://docs.sympy.org/latest/modules/solvers/solvers.html

UNIT TESTS

Image
There are two types of engineers in this world(software context): type-1 just writes code and walks away, they assume everything will work fine. type-2 does the unit test and brings the piece of mind to type-1. Now we go through the unit testing in python, This helps us to the verify how well our code works with the required inputs. If we ask an engineer to write the code for the area of the circle, he writes it with no effort. from math import pi def circle_area(r): return pi*(r**2) #Test function will not be return by type-1 Engineers #Testing function radii = [2, 0, -3, 2+3j,True ,"radius"] message = "Area of circle with r = {radius} is {area}" for r in radii: A = circle_area(r) print(message.format(radius=r, area=A)) Output: we have written the testing code just to show you how the code goes wrong with the inputs. engineers just write the function and get relaxed. From the above i

Embedding the GitHub Gists codes into blogs

Image
Create the gist of your codes: Then get the embedding link. Click the HTML link and place the embedded link at the desired position. Code your code snippet appears as magic with git link in the below. Above process works for dynamic themes like Contempo in bloggers, but it fails for other dynamic themes so go for step 5. https://stackoverflow.com/questions/18788724/issues-adding-github-gist-to-my-blogusing-google-blogger/21355714#21355714  is the link where you can find the information to display the codes of Github with Gists in dynamic blogs.

Splitting criteria

Image
This package helps to find splitting criteria in C4.5 Information Gain ID3 uses information gain as its attribute selection measure. This measure is based on pioneering work by Claude Shannon on information theory, which studied the value or “information content” of messages. Let node N represent or hold the tuples of partition D. The attribute with the highest information gain is chosen as the splitting attribute for node N. This attribute minimizes the information needed to classify the tuples in the resulting partitions and reflects the least randomness or “impurity” in these partitions. Such an approach minimizes the expected number of tests needed to classify a given tuple and guarantees that a simple (but not necessarily the simplest) tree is found. The expected information needed to classify a tuple in D is given by: where pi is the probability that an arbitrary tuple inDbelongs to classCi and is estimated by |Ci,D|/|D|. A log function to the base 2 is used becaus

QUOTATION SERVER AND CLIENT

Image
A simple program of server and client where the server sent a good quote to the connected client immediately after the connection(as welcoming). Multiple Clients are handled using java multithreading concept, Used UDP datagram sockets, and text where quotes are stored.  The output of the above program: Outputs after quotes are completed:

SQLiteDatabase

Image
An application which deals with Database, Custom ListView : This is a simple application which covers some of the basic topics of android like AsyncTask, SQLiteDatabase-insertion, Custom ListView UI's of app:                                                                                     activity_main.xml : <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"     android:layout_width="match_parent"     android:layout_height="match_parent"     android:orientation="vertical">     <EditText         android:id="@+id/textName"         android:layout_width="match_parent"         android:layout_height="wrap_content"         android:ems="10"         android:hint="Name"         android:inputType="textPersonName" />     <EditText         android: