Logo Lanfrica

YsneAtigui/Amazigh-OCR

Domain:

natural language processing

Record type:

software
Creator:
Ysn
Host:
Tifinagh OCR system using CRNN (Convolutional Recurrent Neural Network) with VGG16-BN backbone, based on the DocTR framework architecture. # Tifinagh OCR Training with CRNN + VGG16-BN This repository contains a complete implementation of a Tifinagh OCR system using CRNN (Convolutional Recurrent Neural Network) with VGG16-BN backbone, based on the DocTR framework architecture. ## Overview The system consists of: - **VGG16-BN Feature Extractor**: Pre-trained VGG16 with Batch Normalization for robust feature extraction - **Bidirectional LSTM**: For sequence modeling of text with configurable layers - **CTC Loss**: For alignment-free training - **Advanced Data Augmentation**: Custom OCR-specific augmentations including perspective transforms, elastic deformation, and noise injection - **Comprehensive Training Pipeline**: With progressive augmentation, multiple schedulers, and WandB integration ## Architecture ``` Input Image (32x128) ↓ VGG16-BN Feature Extractor ↓ Feature Maps (512 channels) ↓ Bidirectional LSTM Layers ↓ CTC Decoder ↓ Tifinagh Text Output ``` ## Data Structure The training system expects the following data structure (as generated by `data_generation.py`): ``` data/ ├── images/ │ ├── train/ │ │ ├── train_annotations.json │ │ ├── 0.jpg │ │ ├── 1.jpg │ │ └── ... │ ├── val/ │ │ ├── val_annotations.json │ │ ├── 0.jpg │ │ └── ... │ └── test/ │ ├── test_annotations.json │ └── ... └── dict/ ├── clean_dict.txt └── corpus_dict.txt ``` ### Annotation Format The annotation files are JSON dictionaries mapping image filenames to their corresponding Tifinagh text: ```json { "0.jpg": "ⵉⴼⵓⵍⵓ", "1.jpg": "ⴰⵎⴷⵊⴰⵡ", "2.jpg": "ⵜⴰⴹⵓ" } ``` ## Installation 1. **Clone the repository**: ```bash git clone cd tamazight_ocr ``` 2. **Install dependencies**: ```bash pip install -r requirements.txt ``` 3. **Verify vocabulary configuration**: ```bash python vocab_config.py ``` ## Available Scripts ### Main Training Scripts - **`train_tifinagh_crnn.py`**: Advanced CRNN training with custom augmentations and comprehensive monitoring - **`train_crnn.py`**: Simpl …