Developed a Raspberry Pi 4-based system to automate inventory management by capturing product label images, extracting text using PaddleOCR, and categorizing entity-based information with RegEx. The extracted data is stored in MongoDB, allowing structured storage and efficient querying.
Ideal for industries requiring streamlined inventory management, this system uses Raspberry Pi and a camera module to capture product label images, perform OCR-based data extraction, and store the structured information in MongoDB.
- Features
- Practical Use Cases
- System Requirements
- Required Libraries
- Setup and Installation
- Project Structure
- Future Enhancements
- Contact
- Automated Image Capture: Uses a camera module to capture product label images.
- OCR Text Extraction: Extracts text from images via PaddleOCR.
- Entity Parsing: Identifies key product attributes (weight, volume, voltage, etc.) using RegEx.
- Data Storage: Stores structured data in MongoDB for easy access and analysis.
- Manufacturing Plants: Tracks materials and products in real-time.
- Warehouses: Automates inventory logging, minimizing manual errors.
- Retail: Manages product details and availability, streamlining restocking.
- Raspberry Pi 4 (or compatible)
- Raspberry Pi Camera Module
- 32 GB MicroSD Card (minimum recommended)
- Python 3 (pre-installed on Raspberry Pi OS)
- MongoDB Atlas or local MongoDB installation for data storage
- Internet Connection
Install these Python libraries on your Raspberry Pi environment:
pip3 install paddleocr pymongo pillow flask- paddleocr: For text extraction from images.
- pymongo: For MongoDB interaction.
- pillow: For image processing.
- flask: To create a REST API for image uploads.
- Set up Raspberry Pi: Complete initial setup (configure language, time zone, etc.).
- Enable Camera:
- Open Raspberry Pi Configuration from the main menu.
- In the Interfaces tab, enable Camera and SSH (for remote access).
- Update System:
sudo apt update && sudo apt upgrade -y - Install Python and pip:
sudo apt install python3 python3-pip -y
- MongoDB Atlas: Create an account and set up a new cluster.
- Obtain the MongoDB connection URI.
- Whitelist your IP for database access.
-
Clone the Project Repository:
git clone https://github.com/Dhyey122403/Image-Based-Data-Extraction-System cd Image-Based-Data-Extraction-System -
Download the PaddleOCR model (for OCR):
paddleocr --lang en
-
Edit MongoDB Connection:
- Open
app.pyand replacemongodb_uriwith your MongoDB URI.
- Open
-
Run the Application:
python3 app.py
To test image upload and data extraction:
- Use a tool like Postman or CURL to send an image to your Flask endpoint (
/upload).
Example CURL command:
curl -X POST -F "file=@/path/to/image.jpg" http://<raspberry-pi-ip>:5000/uploadHere’s the general structure for this project:
Image-Based-Data-Extraction-System/
├── app.py # Main application script
├── ocr_module.py # Module for OCR extraction using PaddleOCR
├── mongo_module.py # MongoDB interactions (CRUD operations)
├── requirements.txt # List of required Python libraries
├── README.md # Project documentation
├── uploads/ # Directory to store uploaded images temporarily
└── templates/ # Flask templates (if needed)
Currently Flask is under progress , you can verify other files by running main.py
- Extend Entity Extraction: Add patterns to capture additional product attributes.
- Enhance OCR Accuracy: Experiment with additional image pre-processing.
- Dashboard Interface: Build a dashboard for real-time inventory tracking and analytics.
For questions or support, please reach out at dhyeysavaliya.dks@gmail.com.