CoolFace
Datasetpublic

thekfp/synthetic-cameroon-national-id-card-orc-dataset

๐Ÿ‡จ๐Ÿ‡ฒ Cameroon National ID Card OCR Dataset Synthetic dataset for information extraction from Cameroonian National Identity Cards via OCR. ๐Ÿ“‹ Description This dataset contains 60,000 examples of simulated OCR text from Cameroonian National ID Cards with corresponding structured information in JSON format. The data covers two ID card formats (2018 and 2025) and two sides (front/back) with different levels of OCR noise. ๐ŸŽฏ Use Cases Fine-tuning LLMโ€ฆ See the full description on the dataset page: https://huggingface.co/datasets/thekfp/synthetic-cameroon-national-id-card-orc-dataset.

sourceHugging Faceupdated 1y agoView on Hugging Face
0likes21downloads
Dataset Card

๐Ÿ‡จ๐Ÿ‡ฒ Cameroon National ID Card OCR Dataset

Synthetic dataset for information extraction from Cameroonian National Identity Cards via OCR.

๐Ÿ“‹ Description

This dataset contains 60,000 examples of simulated OCR text from Cameroonian National ID Cards with corresponding structured information in JSON format. The data covers two ID card formats (2018 and 2025) and two sides (front/back) with different levels of OCR noise.

๐ŸŽฏ Use Cases

  • โ€”Fine-tuning LLM models for named entity extraction
  • โ€”Training official document recognition systems
  • โ€”Developing ID card digitization applications
  • โ€”Research in automatic government document processing

๐Ÿ“Š Dataset Structure

Distribution

  • โ€”4 separate datasets: cni_2018_recto, cni_2018_verso, cni_2025_recto, cni_2025_verso
  • โ€”15,000 examples per dataset
  • โ€”Total: 60,000 examples

Columns

ColumnTypeDescription
IDstringUnique identifier ({format}_{side}_{number})
ocr_textstringSimulated OCR text with realistic noise
resultstringJSON of extracted information (ground truth)
niveau_bruitageintOCR noise level (0=light, 1=medium, 2=heavy)

Noise Distribution

  • โ€”45% Light noise (code 0): 6,750 examples per dataset
  • โ€”35% Medium noise (code 1): 5,250 examples per dataset
  • โ€”20% Heavy noise (code 2): 3,000 examples per dataset

๐Ÿท๏ธ ID Card Formats

2018 ID Card - Front

Extracted fields:

json
{
  "nom_surname": "string",
  "prenom_given_name": "string", 
  "date_of_birth": "DD.MM.YYYY",
  "lieu_of_birth": "string",
  "sex": "M|F",
  "taille": "X.XX",
  "profession": "string"
}

2018 ID Card - Back

Extracted fields:

json
{
  "pere_father": "string",
  "mere_mother": "string",
  "sp_sm": "6 digits",
  "date_of_issue": "DD.MM.YYYY",
  "date_of_expiration": "DD.MM.YYYY", 
  "identifiant_unique": "17 digits",
  "numero_de_carte": "9 digits",
  "authorite": "Martin MBARGA NGUร‰Lร‰"
}

2025 ID Card - Front

Extracted fields:

json
{
  "numero_de_carte": "9 digits",
  "nom_surname": "string",
  "prenom_given_name": "string",
  "date_of_birth": "DD.MM.YYYY", 
  "sex": "M|F",
  "date_of_expiration": "DD.MM.YYYY"
}

2025 ID Card - Back

Extracted fields:

json
{
  "pere_father": "string",
  "mere_mother": "string", 
  "lieu_of_birth": "string",
  "date_of_issue": "DD.MM.YYYY",
  "taille": "X.XX",
  "profession": "string",
  "identifiant_unique": "2 letters + 9 digits",
  "authorite": "Martin MBARGA NGUร‰Lร‰"
}

๐Ÿ”ง Data Generation

Source Data

  • โ€”320 authentic Cameroonian names (all regions)
  • โ€”320 typical Cameroonian given names
  • โ€”500 Cameroonian cities and villages
  • โ€”500 local professions
  • โ€”Algorithmically generated dates, heights, and numbers

Realistic OCR Simulation

OCR noise includes:

  • โ€”Element omission (40% priority) - missing labels and values
  • โ€”Character corruption (10%) - visually similar substitutions (Oโ†’0, Iโ†’1)
  • โ€”Missing spaces (5%) - fusion of adjacent words
  • โ€”Alphanumeric noise (10%) - parasitic characters XZ7, A3K
  • โ€”Order reversal (10%) - permutation of nearby elements

Information Preservation

  • โ€”Minimum 60% of critical information preserved
  • โ€”Differential noise by type (labels > alphabetic values > numeric values)
  • โ€”Special protection for dates and identifiers

๐Ÿ“ˆ Usage

Loading the Dataset

python
from datasets import load_dataset

# Load a specific dataset
dataset = load_dataset("username/cameroon-cni-ocr", "cni_2018_recto")

# Access the data
print(dataset['train'][0])
# {
#   'ID': 'cni_2018_recto_000001',
#   'ocr_text': 'REPUBLIQUE CAMEROUN NOM KENGALI FEGUE...',
#   'result': '{"nom_surname": "KENGALI FEGUE", ...}',
#   'niveau_bruitage': 1
# }

Fine-tuning Example

python
from transformers import AutoTokenizer, AutoModelForCausalLM, Trainer

# Recommended prompt format
def format_prompt(ocr_text):
    return f"Extract JSON from this Cameroonian ID card:\n{ocr_text}\nJSON:"

# Fine-tuning with Trainer
# (see example scripts in the repository)

Filtering by Noise Level

python
# Progressive training by difficulty
easy_data = dataset.filter(lambda x: x['niveau_bruitage'] == 0)
medium_data = dataset.filter(lambda x: x['niveau_bruitage'] == 1)  
hard_data = dataset.filter(lambda x: x['niveau_bruitage'] == 2)

๐Ÿ“ Included Files

๐Ÿ“ฆ cameroon-cni-ocr/
โ”œโ”€โ”€ ๐Ÿ“„ README.md
โ”œโ”€โ”€ ๐Ÿ“Š cni_2018_recto.csv       # 2018 ID front dataset (15k rows)
โ”œโ”€โ”€ ๐Ÿ“Š cni_2018_verso.csv       # 2018 ID back dataset (15k rows)  
โ”œโ”€โ”€ ๐Ÿ“Š cni_2025_recto.csv       # 2025 ID front dataset (15k rows)
โ”œโ”€โ”€ ๐Ÿ“Š cni_2025_verso.csv       # 2025 ID back dataset (15k rows)
โ”œโ”€โ”€ ๐Ÿ”ง scripts/
โ”‚   โ”œโ”€โ”€ generate_dataset.py     # Complete generation script
โ”‚   โ”œโ”€โ”€ bruitage_ocr.py        # OCR noise functions
โ”‚   โ”œโ”€โ”€ fine_tuning_qwen3.py   # Fine-tuning script
โ”‚   โ””โ”€โ”€ evaluation_metrics.py  # Evaluation metrics
โ”œโ”€โ”€ ๐Ÿ“‹ data/
โ”‚   โ”œโ”€โ”€ donnees_completes.json # Source data (names, places, etc.)
โ”‚   โ”œโ”€โ”€ etiquettes_bruit.json  # OCR noise configuration
โ”‚   โ””โ”€โ”€ templates_cni.py       # ID card templates by format
โ””โ”€โ”€ ๐Ÿ“– docs/
    โ”œโ”€โ”€ methodology.md         # Detailed methodology
    โ””โ”€โ”€ evaluation_results.md  # Benchmark results

๐ŸŽฏ Evaluation Metrics

To evaluate models on this dataset:

Recommended Metrics

  • โ€”ROUGE-1/2/L: Textual similarity
  • โ€”Exact Match: Perfectly correct JSON
  • โ€”Key Accuracy: % of correct JSON keys
  • โ€”Value Accuracy: % of correct values
  • โ€”Parse Success Rate: % of syntactically valid JSON

โš–๏ธ Ethical Considerations

Synthetic Data

  • โ€”All data is synthetic and does not correspond to any real person
  • โ€”Names and information are randomly generated from public lists
  • โ€”No real personal information was used

Responsible Use

  • โ€”This dataset is designed for research and development
  • โ€”Commercial applications must comply with local regulations
  • โ€”Do not use to create fake identities or fraudulent documents

Potential Biases

  • โ€”Geographic representation centered on Cameroon
  • โ€”Names from major Cameroonian ethnic groups
  • โ€”Format limited to Cameroonian ID cards (not generalizable)

๐Ÿ“œ License

Apache 2.0 - Free use for research and commercial applications.

๐Ÿค Contributing

To report issues or suggest improvements:

  • โ€”Open an issue on GitHub
  • โ€”Submit pull requests for scripts
  • โ€”Share your fine-tuning results

๐Ÿ“š Citation

If you use this dataset in your research:

bibtex
@dataset{cameroon_cni_ocr_2025,
  title={Cameroon National ID Card OCR Dataset: Synthetic Dataset for Information Extraction from Cameroonian National Identity Cards},
  author={[Pacom KENGALI F.]},
  year={2025}