/PCB-Components-Detection-using-Mask-RCNN

Creating a PCB (Printed Circuit Board) components detection project using Mask R-CNN (Region-based Convolutional Neural Network) is a fascinating computer vision task. Below, I'll provide you with an outline of the project details, including its objectives, components, and steps to execute it successfully

Primary LanguagePython

PCB-Components-Detection-using-Mask-RCNN using Tensorflow 2

Detecting components on printed circuit boards (PCBs) is a critical task in electronics manufacturing and quality control. This project utilizes Mask R-CNN, implemented with TensorFlow 2.5.0, to accurately identify and localize various PCB components including capacitors, integrated circuits (ICs), connectors, and transistors, achieving a remarkable Mean Average Precision (mAP) score of 0.91.

270763672-22914e99-462c-4756-ada4-66e235cd9a4e

Annotation tool used : VGG annotator (https://www.robots.ox.ac.uk/~vgg/software/via/) was used for precise annotation of PCB components in the dataset..

The ResNet101 backbone was chosen for feature extraction due to its ability to capture complex features, which proved beneficial for accurate component detection. but the model is very complex for the training data which consists of 1971 images(total 20790 region of interest) and 717 validation images (13506 region of interest).Some of the techniques that are followed to improve the model :

  1. Learning Rate Schedular - This help to schedule the learning rate after each epoch and aviods the vanishing or exploding gradient descent issue.
  2. Adam Optimizer - Instead of using SGD Optimizer Adam optimizer is used as it can prevent overfititng of model
  3. Data Preprocessing - Data preprocessing techniques, including center cropping, grayscale conversion, flipping, rotation at various angles, and image enhancement (brightness, contrast, and saturation adjustments), were applied to augment the dataset. This significantly increased the dataset size and improved the model's performance,where applied before training model and then annotated to increase the size of dataset. finally this technique have improved my model from mAP of 0.45 to 0.91. (Without applying image augmentation during model training, training data and validation data is increased by 60%)
  4. Hyperparamater Tunning - The given below table represents the hyperparameters of the model.

HYP1 HYP2 HYP3

Limitations of this project

Due to limited GPU resources on Google Colab, the model was trained for up to 50 epochs.

Model Depolyment using Flask

In this project, I have developed a Flask-based web application that leverages the capabilities of Mask R-CNN to automate the detection of PCB components. This application provides a user-friendly interface for users to upload images of PCBs, and it returns annotated images with components highlighted and labeled.

ezgif com-video-to-gif

f1_1 f2