This repository demonstrates barcode detection and decoding using both rule-based approaches with OpenCV and pyzbar, as well as deep learning methods with Mask-RCNN instance segmentation using the detectron2 framework.
- The dataset used for training the deep learning model consists of 12-14 annotated images tailored to the project's requirements.
- Additional images are included for testing and validation.
- Results of the detection and decoding are available in the following Google Drive folder: Results
To explore the code and detailed explanation, switch to the project directory:
cd {Directory name}A rule-based approach using OpenCV and pyzbar is implemented with hard-coded kernel functions.
For deep learning-based detection, Mask-RCNN instance segmentation model is employed using detectron2.
-
Detects objects without visible barcodes and outlines them with red bounding boxes.
-
Detects all objects and draws black bounding boxes around them.
-
Draws blue bounding boxes around complete visible barcodes and yellow bounding boxes otherwise.
Given the small dataset size (10-12 images per case), the results indicate potential overfitting. To improve the model's performance, consider the following actions:
- Increase the size and diversity of the dataset.
- Apply data augmentation techniques to enhance generalization.
- Experiment with alternative deep learning models suited for barcode detection.
Pretrained models for barcode detection were considered but avoided due to dataset mismatch with the provided dataset.







