Skip to content

ParthS007/Pattern-Recognition

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Pattern Recognition Course Projects

A comprehensive collection of pattern recognition and machine learning implementations developed for university coursework. This repository contains practical implementations of fundamental algorithms and techniques in pattern recognition, computer vision, and deep learning.

📋 Table of Contents

🎯 Overview

This repository provides a hands-on introduction to modern pattern recognition, covering the journey from basic classifiers to advanced deep learning techniques. The projects progress through:

  1. Fundamental Classifiers: Implementation of perceptron and k-NN classifiers for digit recognition
  2. Evaluation Metrics: Development of comprehensive evaluation frameworks
  3. Statistical Learning: Logistic regression and probabilistic approaches
  4. Feature Engineering: Image processing and feature extraction techniques
  5. Deep Learning: Autoencoders and neural network approaches
  6. Advanced Applications: Medical image segmentation and latent space modeling

The course emphasizes building a probabilistic framework for pattern recognition, deriving optimal classifiers, and exploring both traditional feature design and modern deep learning approaches.

📁 Project Structure

Pattern-Recognition/
├── 1/                          # Assignment 1: Basic Classifiers
│   ├── perceptron.py          # Multi-class perceptron implementation
│   ├── knn.py                 # k-Nearest Neighbors classifier
│   ├── document_classification.py  # Text classification using k-NN
│   ├── random_classifier.py   # Random baseline classifier
│   └── PR23_assignment1.pdf   # Assignment instructions
├── 2/                          # Assignment 2: Evaluation Metrics
│   ├── metrics.py             # Comprehensive evaluation metrics
│   └── PR23_assignment2.pdf   # Assignment instructions
├── 3/                          # Assignment 3: Logistic Regression
│   ├── logistic.py            # Logistic regression implementation
│   ├── classifier.py          # Advanced classification techniques
│   ├── filter.py              # Image filtering operations
│   └── PR23_assignment3.pdf   # Assignment instructions
├── 4/                          # Assignment 4: Feature Engineering
│   ├── data_loader.py         # BSDS300 dataset loader
│   ├── feature.py             # Feature extraction methods
│   ├── gradient_feature.py    # Gradient-based features
│   ├── boundary.py            # Boundary detection algorithms
│   ├── filter.py              # Advanced filtering techniques
│   ├── logistic.py            # Logistic regression for features
│   ├── metrics.py             # Performance evaluation
│   └── PR23_assignment4.pdf   # Assignment instructions
├── 5/                          # Assignment 5: Image Restoration
│   ├── *.pt                   # Pre-trained PyTorch models
│   ├── *.png                  # Result visualizations
│   └── Pattern_Recognition_Exercises_2023-5.pdf
├── 6/                          # Assignment 6: Deep Learning
│   ├── latent.ipynb           # Autoencoder and latent space analysis
│   ├── segment.ipynb          # Medical image segmentation
│   └── PR23_assignment6.pdf   # Assignment instructions
├── Test/                       # Sample implementations
│   └── sample.py              # Basic mathematical operations
├── LICENSE                     # MIT License
└── README.md                   # This file

📚 Assignments

Assignment 1: Fundamental Classifiers

  • Multi-class Perceptron: Implementation for MNIST digit recognition
  • k-Nearest Neighbors: Distance-based classification algorithm
  • Document Classification: Text classification using bag-of-words and k-NN
  • Random Classifier: Baseline comparison model

Key Concepts: Basic classification, one-hot encoding, distance metrics, text preprocessing

Assignment 2: Evaluation Metrics

  • Classification Metrics: Accuracy, precision, recall, F1-score
  • ROC Analysis: ROC curves and AUC computation
  • Statistical Evaluation: Comprehensive performance assessment

Key Concepts: Model evaluation, statistical measures, performance comparison

Assignment 3: Statistical Learning

  • Logistic Regression: Sigmoid function, gradient descent optimization
  • Advanced Classification: Feature standardization, ROC analysis
  • Image Filtering: Convolution operations, frequency domain processing

Key Concepts: Probabilistic classification, optimization, signal processing

Assignment 4: Feature Engineering & Computer Vision

  • Dataset Handling: BSDS300 image dataset loader
  • Feature Extraction: Texture, color, and brightness gradient features
  • Boundary Detection: Edge detection and segmentation
  • Gradient Features: Multi-scale and orientation-based features

Key Concepts: Computer vision, feature engineering, image processing

Assignment 5: Image Restoration

  • Deep Learning Models: Pre-trained networks for image restoration
  • Applications: Denoising, deblurring, and enhancement
  • Evaluation: Visual and quantitative assessment

Key Concepts: Image restoration, deep learning applications, model evaluation

Assignment 6: Advanced Deep Learning

  • Autoencoders: Dimensionality reduction and latent space modeling
  • Medical Image Segmentation: U-Net architecture for polyp segmentation
  • Generative Modeling: Sampling from latent space representations

Key Concepts: Deep learning, autoencoders, medical imaging, segmentation

🛠️ Dependencies

Core Libraries

numpy>=1.21.0
matplotlib>=3.5.0
scipy>=1.7.0
scikit-learn>=1.0.0
pandas>=1.3.0

Deep Learning (Assignment 6)

torch>=1.10.0
torchvision>=0.11.0
segmentation-models-pytorch

Image Processing

scikit-image>=0.18.0
opencv-python>=4.5.0

Jupyter Notebooks

jupyter>=1.0.0
ipython>=7.0.0

🚀 Getting Started

  1. Clone the repository:
git clone https://github.com/username/Pattern-Recognition.git
cd Pattern-Recognition
  1. Set up Python environment (recommended):
python -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate
  1. Install dependencies:
pip install -r requirements.txt  # Create requirements.txt with above dependencies
  1. Verify installation:
python Test/sample.py

💻 Usage

Running Individual Assignments

Assignment 1 - Basic Classifiers:

cd 1/
python perceptron.py
python knn.py
python document_classification.py

Assignment 2 - Evaluation Metrics:

cd 2/
python metrics.py

Assignment 3 - Logistic Regression:

cd 3/
python logistic.py
python classifier.py

Assignment 4 - Feature Engineering:

cd 4/
python data_loader.py
python feature.py
python boundary.py

Assignment 6 - Deep Learning:

cd 6/
jupyter notebook latent.ipynb
jupyter notebook segment.ipynb

Example Usage

# Example: Using k-NN classifier
from knn import KNNClassifier

# Initialize classifier
knn = KNNClassifier(k=5)

# Train the model
knn.train(X_train, y_train)

# Make predictions
predictions = knn.predict(X_test)
# Example: Using evaluation metrics
from metrics import Metrics

# Calculate performance metrics
accuracy = Metrics.accuracy(y_true, y_pred)
precision = Metrics.precision(y_true, y_pred)
recall = Metrics.recall(y_true, y_pred)
f1 = Metrics.f1_score(y_true, y_pred)

🎓 Learning Objectives

By working through these assignments, you will gain experience with:

  • Classical Machine Learning: Perceptron, k-NN, logistic regression
  • Evaluation Techniques: Cross-validation, ROC analysis, statistical testing
  • Feature Engineering: Image processing, gradient features, texture analysis
  • Deep Learning: Autoencoders, CNNs, segmentation networks
  • Computer Vision: Image restoration, medical image analysis
  • Software Engineering: Clean code practices, modular design

📈 Results and Applications

The implementations cover real-world applications including:

  • MNIST Digit Recognition: Achieving competitive accuracy with basic classifiers
  • Document Classification: Text analysis using natural language processing
  • Medical Image Segmentation: Automated polyp detection in endoscopic images
  • Image Restoration: Denoising and deblurring using deep learning
  • Boundary Detection: Edge detection in natural images

🤝 Contributing

This repository is primarily for educational purposes. If you find bugs or have suggestions for improvements:

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Submit a pull request

📄 License

This project is licensed under the MIT License - see the LICENSE file for details.

👨‍💼 Author

Parth Shandilya

🙏 Acknowledgments

  • Course instructors and teaching assistants
  • University Pattern Recognition course materials
  • Open-source libraries and datasets used throughout the projects

About

No description, website, or topics provided.

Resources

License

Stars

0 stars

Watchers

1 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors