Skip to content

Latest commit

 

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🚀 Mask R-CNN From Scratch | TensorFlow & Keras

A complete educational implementation of Mask R-CNN from scratch using TensorFlow/Keras. Learn the complete architecture behind CNNs, ResNet-50, Feature Pyramid Network (FPN), Region Proposal Network (RPN), ROI Align, Object Detection, Classification, Bounding Box Regression, and Instance Segmentation without relying on pre-built implementations.


⭐ Project Highlights

  • ✅ Mask R-CNN implemented from scratch
  • ✅ TensorFlow/Keras Functional API
  • ✅ ResNet-50 Backbone
  • ✅ Feature Pyramid Network (FPN)
  • ✅ Region Proposal Network (RPN)
  • ✅ ROI Align
  • ✅ Detection Head
  • ✅ Mask Head
  • ✅ Bounding Box Prediction
  • ✅ Multi-class Object Detection
  • ✅ Pixel-level Instance Segmentation
  • ✅ Educational implementation with detailed explanations

🧠 What is Mask R-CNN?

Mask R-CNN is one of the most influential deep learning architectures in Computer Vision.

Unlike traditional CNN models that only classify images, Mask R-CNN can simultaneously perform:

  • Image Classification
  • Object Detection
  • Bounding Box Prediction
  • Instance Segmentation
  • Confidence Score Prediction

This repository focuses on understanding how every component works internally, instead of simply using an existing implementation.


📚 Topics Covered

This repository explains and implements:

  • Convolutional Neural Networks (CNN)
  • Feature Maps
  • Convolution Mathematics
  • Padding
  • Stride
  • Pooling
  • Batch Normalization
  • Residual Learning
  • ResNet-50
  • Feature Pyramid Network (FPN)
  • Anchor Generation
  • Region Proposal Network (RPN)
  • ROI Align
  • Classification Head
  • Bounding Box Regression
  • Mask Prediction
  • Non-Maximum Suppression (NMS)
  • Loss Functions
  • Training Pipeline
  • Inference Pipeline

🏗️ Project Architecture

Input Image
      │
      ▼
ResNet-50 Backbone
      │
      ▼
Feature Pyramid Network (FPN)
      │
      ▼
Region Proposal Network (RPN)
      │
      ▼
ROI Align
      │
      ├───────────────┐
      ▼               ▼
Detection Head    Mask Head
      │               │
      ▼               ▼
Bounding Boxes   Segmentation Masks
      │
      ▼
Final Predictions

📂 Project Structure

mask-RCNN-from-scratch/

├── images/
├── models/
│   ├── backbone.py
│   ├── detection_head.py
│   └── mask_head.py
│
├── backbone.py
├── config.py
├── dataset_loader.py
├── training.py
├── main.py
├── utils.py
└── .gitignore

🎯 Features

  • Modular implementation
  • Clean code structure
  • Beginner-friendly
  • Well-documented code
  • Educational project
  • Easily extendable
  • Research-oriented implementation

💻 Technologies Used

  • Python
  • TensorFlow
  • Keras
  • NumPy
  • OpenCV
  • COCO Dataset
  • Matplotlib

🧩 Core Modules

✅ CNN Fundamentals

  • Convolution
  • Activation Functions
  • Pooling
  • Padding
  • Stride

✅ Backbone Network

  • ResNet-50

✅ Feature Pyramid Network

  • Multi-scale Feature Extraction

✅ Region Proposal Network

  • Anchor Generation
  • Proposal Scoring
  • Bounding Box Regression

✅ ROI Align

  • Accurate Feature Extraction
  • Quantization-free Region Pooling

✅ Detection Head

  • Object Classification
  • Bounding Box Refinement

✅ Mask Head

  • Pixel-wise Instance Segmentation

📈 Learning Roadmap

  • Project Setup
  • CNN Fundamentals
  • Convolution Mathematics
  • ResNet-50
  • Feature Pyramid Network
  • Region Proposal Network
  • ROI Align
  • Detection Head
  • Mask Head
  • Complete Mask R-CNN
  • COCO Dataset Training
  • Inference Pipeline

🎓 Who Is This Repository For?

  • Computer Vision Learners
  • Deep Learning Enthusiasts
  • AI Students
  • Research Students
  • Machine Learning Engineers
  • TensorFlow Developers
  • Interview Preparation
  • University Projects
  • Final Year Projects

📖 Keywords

Mask R-CNN, Mask RCNN, CNN, Convolutional Neural Networks, TensorFlow, Keras, Computer Vision, Deep Learning, Neural Networks, Object Detection, Instance Segmentation, ResNet, Feature Pyramid Network, Region Proposal Network, ROI Align, COCO Dataset, Image Segmentation, Artificial Intelligence, Machine Learning.


🌟 Support

If this repository helps you learn Mask R-CNN, consider giving it a ⭐.

Your support helps the project reach more students and developers.


👨‍💻 Author

NAGARGOJE UTTAM

Passionate about Artificial Intelligence, Deep Learning, Computer Vision, Machine Learning, and building educational implementations of advanced neural network architectures from scratch.


📜 License

This project is released under the MIT License.


🚀 Future Goals

  • Training on COCO Dataset
  • Real-time Inference
  • Custom Dataset Training
  • Faster Training Pipeline
  • Model Evaluation
  • Visualization Tools
  • ONNX Export
  • TensorRT Optimization
  • Docker Support
  • Research Documentation

"Don't just use AI models. Understand how they work from the ground up."

About

Complete Mask R-CNN implementation from scratch using TensorFlow & Keras | Computer Vision | Deep Learning | ResNet-50 | FPN | RPN | ROI Align | Object Detection | Instance Segmentation

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages