https://github.com/sombitpramanik/facerecognitiononrpi
Complete journey of my Face Recognition Project working on the Raspberry pi
https://github.com/sombitpramanik/facerecognitiononrpi
Last synced: 19 days ago
JSON representation
Complete journey of my Face Recognition Project working on the Raspberry pi
- Host: GitHub
- URL: https://github.com/sombitpramanik/facerecognitiononrpi
- Owner: SombitPramanik
- License: mit
- Created: 2024-07-11T05:51:37.000Z (10 months ago)
- Default Branch: main
- Last Pushed: 2024-11-20T06:44:10.000Z (6 months ago)
- Last Synced: 2025-04-30T05:05:04.601Z (19 days ago)
- Language: Python
- Homepage:
- Size: 4.9 MB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Pre-Final Algorithm Details
## k-Nearest Neighbors (k-NN) Algorithm
### Overview
The k-Nearest Neighbors (k-NN) algorithm is a simple, non-parametric, and instance-based learning method used for classification and regression. The primary idea is to classify a data point based on how its neighbors are classified. It is particularly effective for classification tasks.### How It Works
1. **Training Phase**: The k-NN algorithm does not explicitly train a model. Instead, it stores all the training data points. This means that it defers computation until the prediction phase, making it a lazy learning algorithm.
2. **Prediction Phase**:
- Given a new, unlabeled data point, the algorithm identifies the k nearest data points (neighbors) from the training set.
- The distance metric, often Euclidean distance, is used to find these nearest neighbors.
- The class of the new data point is determined by the majority class among the k neighbors. For regression, the average value of the k neighbors is used.### Advantages
- Simple to understand and implement.
- Effective with a small number of training samples.
- No need for explicit training phase.### Disadvantages
- Computationally expensive during the prediction phase, especially with large datasets.
- Sensitive to irrelevant or redundant features.
- Performance depends on the choice of the distance metric and the value of k.### Example
In the given code, the k-NN algorithm is used with:
- `n_neighbors=1`: This means only the closest neighbor is considered for classification.
- `weights='distance'`: Closer neighbors have more influence on the classification than farther ones.## Ball Tree Data Structure
### Overview
The Ball Tree is a data structure used to organize points in a multi-dimensional space. It is particularly useful for fast nearest neighbor searches and is an alternative to the k-d tree.### How It Works
1. **Tree Construction**:
- The data points are recursively partitioned into nodes called "balls".
- Each ball node contains a center point and a radius, which encompasses all points within that node.
- The partitioning continues until each node contains a small number of points, at which point they become leaf nodes.2. **Query Phase**:
- For a nearest neighbor search, the algorithm traverses the tree, pruning branches that cannot contain closer points than the current best candidate.
- This allows for efficient searching, especially in higher dimensions.### Advantages
- More efficient than brute force search for high-dimensional data.
- Suitable for datasets where points are not uniformly distributed.### Disadvantages
- Tree construction can be expensive.
- Performance can degrade if the data does not fit well into the ball structure.### Example
In the given code, the Ball Tree data Structure is used as the underlying data structure for the k-NN classifier:
- `algorithm='ball_tree'`: Specifies that the Ball Tree data Structure should be used for efficient nearest neighbor searches.### Combining k-NN with Ball Tree
By combining k-NN with the Ball Tree data Structure, the code achieves efficient classification by leveraging the quick nearest neighbor search capabilities of the Ball Tree. This is particularly important when dealing with large datasets and high-dimensional face encodings.## Please Consider Helping me out to build this Repo More Robust and More Optimized
### Please Contribute on this Repo or Support me Financially to Keep Alive this Repo
Open up any BHARAT pay Enable Payment APP and scan this QrCode to make a small Financial support.
# Thanks For Visiting this Repo && Thanks to all of Those Friends, Mentors and well wishers to keep me motivated.