# Dataset preparation for LayoutLM and LiLT

**URL:** </static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fdataset-preparation-for-layoutlm-and-lilt%2F135594%3E%5C
**Category:** Research\
**Created:** [January 14, 2025, 4:22am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fdataset-preparation-for-layoutlm-and-lilt%2F135594 "2025-01-14T04:22:34Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![rushabhGod](https://avatars.discourse-cdn.com/v4/letter/r/a587f6/32.png) [@rushabhGod](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2FrushabhGod)%5C
**Post date:** [January 14, 2025, 4:22am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fdataset-preparation-for-layoutlm-and-lilt%2F135594%2F1 "2025-01-14T04:22:34Z")

</div>

I am working on an OCR project to perform document understanding on a specific type of document with a fixed layout (e.g., mandate forms). The layout has minor variations across images. My goal is to accurately extract **key-value pairs** and output them in JSON format.

Now for dataset preparation, i have samples of the document on which i want to perform OCR and extract text accurately. Now, when i am annotating the dataset, do I have to annotate them as keys and value generally like all keys as **“key”** and all values as **“values”** or each key and values specifically Date\_key, Date\_value, AccountNo\_key, Account\_Value, etc?

Which will be the best practice to annotate my dataset to train it on LayoutLM and LiLT model.?

---

<div class="post-metadata">

**Author:** ![for16](https://avatars.discourse-cdn.com/v4/letter/f/c2a13f/32.png) [@for16](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Ffor16)%5C
**Post date:** [April 27, 2025, 11:01pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fdataset-preparation-for-layoutlm-and-lilt%2F135594%2F2 "2025-04-27T23:01:20Z")

</div>

Hello, may I ask what OCR did you use for this project?
