This project develops an automated system to extract and classify information from invoices using OCR (Optical Character Recognition) and document layout understanding techniques.
- ✅ Automate invoice data entry
- ✅ Reduce errors from manual processing
- ✅ Speed up document processing
- ✅ Support Vietnamese and other languages
| Technology | Purpose |
|---|---|
| PyTesseract | OCR - Extract text from images |
| LayoutLM | Detect layout and classify information |
| PyTorch | Deep Learning framework |
| Streamlit | Web interface |
| Python 3.9+ | Primary programming language |
invoice-extraction-project/
├── src/
| ├── inference.py # Use LayoutLM to predict labels from OCR output
| ├── ocr_engine.py # Use Tesseract to recognize text from images
| ├── utils.py # Contains coordinate and helper functions
├── notebooks/
│ ├── 01_data_preprocessing.ipynb # Data exploration and analysis
│ └── 02_train_layoutlm.ipynb # Model training
├── data/
│ ├── raw/ # Raw data
│ └── processed/ # Processed data
├── models/ # Trained models
├── app.py # Main Streamlit application
├── requirements.txt # Python dependencies
└── README.md # This file
- Python 3.9 or higher
- Tesseract-OCR 4.0+
- Minimum 4GB RAM
- Windows / Linux / macOS
git clone https://github.com/mudotet/Invoice_Extraction_Project.git
cd invoice-extraction-projectpython -m venv venv
# Windows
venv\Scripts\activate
# Linux/macOS
source venv/bin/activateWindows:
- Download from: https://github.com/UB-Mannheim/tesseract/wiki
- Install and add to PATH
Linux:
sudo apt-get install tesseract-ocrmacOS:
brew install tesseractpip install -r requirements.txtstreamlit run app.pyThe app will be available at: http://localhost:8501
- Extract text from invoice images
- Support for Vietnamese and English
- Recognition reliability: >70%
- Automatically identify invoice fields
- Field types: Title, Date, Amount, etc.
- Use LayoutLM to understand context and layout
- Export results as JSON
- Export to CSV/Excel
| Metric | Value |
|---|---|
| Accuracy | ~92% |
| Recall | ~88% |
| Precision | ~95% |
| Processing Time / Image | ~2-3 seconds |
- ✨ Initial release
- 🎯 Basic OCR support with PyTesseract
- 🖼️ Visualize recognition results
- 🌐 Initial web interface