Posts

Showing posts from 2022

The Loss function/Cost Function

Image
In this post we are gonna learn about the loss function in machine learning..The loss functions are essential in machine learning cause they are one who tells the algorithm if it makes mistake in prediction as wrong. so The Loss function/Cost Function are integral part of gradient descent and entropy calculations. Here we are gonna learn a bit about the different cost functions for different types of problems in machine learning. Mathematical Formula for Entropy : Consider a data set having a total number of N classes, then the entropy (E) can be determined with the formula below: Where: P i  = Probability of randomly selecting an example in class I; Entropy always lies between 0 and 1, however depending on the number of classes in the dataset, it can be greater than 1. But the high value of Let's understand it with an example where we have a dataset having three colors of fruits as red, green, and yellow. Suppose we have 2 red, 2 green, and 4 yellow observations throughout the dat

CONVOLUTION: KERNALS FOR FEATURE EXTRACTION IN IMAGE PROCESSING

Image
An image as simple as 200x200 is too much information for a Nueral network or a computer to understand. The machine learning algorithm like logic regression cannot process the 200x200 information of image, even if it does, the results may not be favourable at all. The accuracy of Nueral Network totally depend upon the input we've given it. So in machine learning the NN's preprocess the input and extract necessary information from the input. Something advance such as CONVOLUTION NUERAL NETWORK(CNN) perform feature extraction. In order to extract feature from an image we need convolution in image processing. Convolution is process in signal processing which is used to combine 2 signals. More about convolution in here . Here the convolution in computer vision is for feature extraction . We extract important details from image like Edges,noise removal,etc... The extraction of important data can be achieved by using a KERNAL .  The kernal method is used for sharping,embrose,smoo

DISCRETE FOURIER TRANSFORMATION(DFT)

Image
In this post we are gonna learn about fourier transformation and implementation of Discrete fourier transformation in python. Why we need to use fourier transformation anyway...a normal periodic wave like sine wave has 3 characterstics like Phase,amplitude,frequency that tell us about the wave..it's easy and understandable but what if a wave is unperiodic like this ex. in this example it is not a periodic sinewave..so but an multiple frequencies of waves added together. Hence to analyse these kind of waves we need fourier transformation in signal processing. The fourier transforamation is applied in both Continous and Discrete waves . .In this we are gonna concentrate in DFT(Discrete fourier transformation)..and to visulalize the wave we are gonna use python(cause it's easy to use). we need the following python library to do this : 1.numpy    2.seaborn    3.mathplotlib     DFT(DISCRETE FOURIER TRANSFORMATION) It is applied to specifically discete signals. It is used to break th

logic design 101

Image
  demorgan's Law                                                       

secrets of arduino atmega328p adc

Image
In this tutorials i'm gonna tell you all about the adc present in arduino famous boards like UNO,NANO,MINI....the atmega328p chips consist of the " 10-bit resolution adc " inside the uC. The type of adc is used in is  Successive approximation ADC . these are kind are slow but gives good resolution though. let's dig in registers of adc in atmega328p. To read analog input we need The reg " ADMUX ". T he adc reg have a Pin called AREF (adc reference voltage). The gives 10-bit number i.e 0-1023, 0-0V & 1023-5V. it measures using this formula       Vin = (Analog Ref * analogRead() ) / 1024 we need stable AREF voltage we can use internal 1.1V reference or we need to provide a stable voltage anywhere between 0.3V-5V externally. [NOTE: if ur are planning to provide external voltage to aref pin present on arduino uno,nano,mini, the recommended value is less than 5v to be safe on safe side cause the voltage of external 5v source may not be 5v exactly so if it i

HACK AND CLONE CAR KEY FOB, MY EPIC FAILURE...!!

Image
In this blog post i'm sharing my experience on cloning the my car key fob signal and how to do it properly. first things frist the cars now a days comes with a wireless remote key where u get atleast 2 or 3 options like lock,unlocking ,trunk(we call it as dickey!!!).....these options let your car access wirelessly and some cars are completly keyless for even driving. the keys of the cars are actually communicating with certain frequency like 433.xxxMHz or some countries uses 315.xxxMHz...the car companies uses an algorithm called " ROLLING CODES "...these are not that esay to crack cause they change every time u press key and once the key transmitted it cannot be used again... but a hacker named "samy kamakar" demonstrated an attack called REPLAY ATTACK where u simply transmitt the signal by recording the key fob away from car or blocking the signal and then recording. so this is how i've tried it..frist i needed to listen to the signals as possible in 10KHz

LM386

Image
                 LM386 DIP-package   The LM386 is a dip package OP_AMP specialized for low power audio amplifications still using in these day. there are different types of LM386 versions I'm using LM386 N-4...depending upon the variation the input voltage can vary... for my chip its "min=4V" to "max=18V"    , it has nearly power gain of 1W and 1W may not sound enough but it's enough for a mono audio output speaker. Here are some best youtube videos on op amp by various youtubers .  best project videos on op amps . [Note: before you go make this circuit i recommend powering it with some 9V or 6V battery of walladapter less than 5W or so.] the below circuit is by   AFROTECHMODS  a nice video on building a 1w mono amplifer circuit  using a lm386.  i'm using the circuit in datasheet with gain of A = 200.      The Vin is audio source like a mp3 files container like phone or pc. The it should be connected to a pot to control the audio sound for amplificatio

PYSERIAL WITH ARDUINO(comms with arduino from pc)

Image
In this post we're gonna learn about "pyserial"  python language library package to communicate or log data from arduino to pc (or) we can get rid of the serial port of arduino.H ence we do the same as we do in serial monitor. the module can be installed using pip   for linux: " sudo python -m pip install pyserial"   for windows : " pip install pyserial" here is a small arduino skecth for reading from terminal or cmd from arduino serial port code: import serial as sl #importing the serial lib as name sl import time mon = '/dev/ttyACM0' #declearing a variable for port name baud = 9600 #defining baud rate arduino = serial . Serial(mon, baud, timeout =. 1 ) while True : mon = arduino . readline() print ( 'the read data:,mon' ) #printing message for reading data from serial here is the python file for data loging code: import serial arduino_port = "/dev/ttyACM0" #serial port of Arduino ba