- Automated Document Processing: Utilize computer vision and OCR to automatically classify and extract data from uploaded government documents.
- Fraud Detection: Enable companies to verify the authenticity of documents by comparing them with records in a government database.
- Ease of Use: Provide a user-friendly interface for document submission and verification.
- Accuracy: Enhance the system's accuracy in detecting fraud through improved OCR and document classification.
- Integration: Seamlessly integrate with existing systems and databases used by organizations for document verification.
- Rahul Dev Banjara
- Frontend: User interface for document upload and verification results.
- Backend: Server-side processing, including OCR, document classification, and interaction with the government database.
- Document Processing Engine: Storage for processed documents and verification records.
- OCR Accuracy on Low-Quality Scans: The OCR models may have difficulty with documents that are poorly scanned or distorted.
- Document Classification Confusion: There may be issues with misclassifying documents that have similar formats but different types.
- Scalability Limitations: The system's performance may degrade with high volumes of simultaneous uploads or very high-resolution images.
- Multi-Language Support: Implement support for multiple languages in the OCR and text extraction processes to accommodate diverse user needs and enhance usability across different regions.
- Custom OCR Fine-Tuning: Fine-tune the OCR model with custom datasets for improved accuracy on specific document types.
- Improve Data Quality: Increase the quality and quantity of training data by incorporating a larger set of original and high-quality documents. This will enhance the accuracy and robustness of OCR and classification models.
- Develop Production-Grade Software: Refactor the system to meet production-grade standards, including improving code quality, documentation, testing, and reliability. Implement best practices for software development to ensure robustness and maintainability.
- Integrate Relational Databases: Replace the current dummy JSON database with a relational database system (e.g., PostgreSQL, MySQL) to better manage and query large volumes of data. This will improve data integrity, scalability, and performance.
- Python 3.10 is required for this project. We recommend using a virtual environment to ensure compatibility.
-
Create a virtual environment:
python3 -m venv venv
-
Activate the virtual environment:
- On Linux/macOS:
source venv/bin/activate
- On Windows:
venv\Scripts\activate
- On Linux/macOS:
Before proceeding with installation, download the required models from the provided link. You will need the following models:
- Classification Model
- License Model
- Passport Model
- Citizenship Model
-
Clone the repository:
git clone https://github.com/devrahulbanjara/Document-and-Record-Management
-
Create a directory for the models:
mkdir "trained models"
-
Place the downloaded model files into the
trained_models
directory. -
Navigate to the project directory:
cd Document-and-Record-Management
-
Install dependencies:
pip install -r requirements.txt
-
Run the application:
streamlit run src/app.py
- Synthetic Datasets: Text manually placed on template images to simulate real documents.
- Lost and Found Groups: Documents sourced from Facebook, Instagram, X, and similar platforms.
- Government Samples: Document samples provided by government sources for validation and comparison.
- Path:
src/app.py
- Description: Provides the user interface for document upload, classification, and verification using Streamlit. Users can upload documents via webcam or file, which are then classified and verified.
- Path:
src/classification.py
- Description: Classifies documents into categories such as citizenship, license, passport, and others.
- Path:
src/detection.py
- Description: Detects regions of interest (e.g., name, date of birth) in classified documents using YOLOv8 models.
- Path:
src/ocrtext.py
- Description: Extracts text from detected regions using Optical Character Recognition (OCR).
- Paths:
src/filter_citizenship.py
src/filter_license.py
src/filter_passport.py
- Description: Filters the text extracted via OCR to retrieve relevant details like name, citizenship number, etc., for different document types (citizenship, license, passport).
- Path:
src/process_image.py
- Description: Performs image preprocessing tasks, including resizing, orientation correction, and binarization, before classification and detection.
- Paths:
src/validate_citizenship.py
src/validate_document.py
- Description: Validates the extracted data against records stored in the database to ensure document authenticity.
- Path:
src/plot_details.py
- Description: Generates visual plots and results for detected regions and classified data.
- Path:
src/database.py
- Description: Defines operations to interact with the
database.json
file, which acts as a dummy database for storing and verifying document details.
- Path:
notebooks/
- Description: Contains Jupyter notebooks for model experimentation, including:
- Classification model training and inference (
notebooks/Classification/
) - YOLOv8 model training and inference (
notebooks/YOLOv8/
) - OCR experiments using EasyOCR (
notebooks/OCR/
) - Text filtering experiments after OCR output (
notebooks/Text Filtering/
)
- Classification model training and inference (
- Path:
tests/test_template.py
- Description: Unit tests to ensure the correctness of various components in the document verification system.
- Model Accuracy: 0.98
Metric | Citizenship | License | Passport | Others | Weighted Average |
---|---|---|---|---|---|
Precision | 0.98 | 0.95 | 1.00 | 0.98 | 0.98 |
Recall | 0.98 | 0.98 | 0.96 | 0.98 | 0.98 |
F1 Score | 0.98 | 0.96 | 0.98 | 0.98 | 0.98 |
Metric | Citizenship No. | District | Gender | Name | Year | Overall |
---|---|---|---|---|---|---|
Precision | 0.949 | 0.931 | 0.956 | 0.971 | 0.944 | 0.949 |
Recall | 0.941 | 0.965 | 0.968 | 1.000 | 0.872 | 0.941 |
mAP@50 | 0.970 | 0.978 | 0.974 | 0.995 | 0.951 | 0.970 |
mAP@50-95 | 0.577 | 0.622 | 0.556 | 0.555 | 0.610 | 0.577 |
Metric | Citizenship No. | Contact No. | DOB | License No. | Name | Overall |
---|---|---|---|---|---|---|
Precision | 0.798 | 0.615 | 0.773 | 0.905 | 0.955 | 0.809 |
Recall | 0.923 | 0.917 | 0.910 | 0.947 | 0.954 | 0.930 |
mAP@50 | 0.892 | 0.892 | 0.888 | 0.949 | 0.945 | 0.913 |
mAP@50-95 | 0.506 | 0.546 | 0.551 | 0.573 | 0.448 | 0.533 |
Metric | Citizenship No. | DOB | Name | Passport No. | Surname | Overall |
---|---|---|---|---|---|---|
Precision | 0.994 | 0.982 | 0.982 | 0.938 | 0.992 | 0.978 |
Recall | 0.978 | 0.977 | 0.989 | 0.979 | 0.989 | 0.983 |
mAP@50 | 0.979 | 0.986 | 0.994 | 0.989 | 0.995 | 0.989 |
mAP@50-95 | 0.738 | 0.778 | 0.772 | 0.669 | 0.760 | 0.743 |
Metric | Genuine | Fraudulent |
---|---|---|
Precision | 1.0 | 0.6 |
Recall | 0.7647 | 1.0 |
F1 Score | 0.8667 | 0.75 |
- Overall Accuracy: 82.61%