NielsRogge / Transformers-Tutorials

This repository contains demos I made with the Transformers library by HuggingFace.
MIT License
9.58k stars 1.46k forks source link

Generate KIE Output Json from Any LayoutLM Variant #182

Open purnasai-cyient opened 2 years ago

purnasai-cyient commented 2 years ago

Hi @NielsRogge,

I am trying to convert the key, Value information that is generated from Any layoutLM variant into a JSON File. Need little help in doing that. Any Idea or way to convert to JSON.

Current output Format: image

Required Format: Map Question--->Answer: { "Fax":"614-466-5087", "TO":"George Baroody", "PHONE NUMBER":"(336) 335-7363", "DATE":"12/10/98", "NUMBER OF PAGES INCLUDING COVER SHEET:":"3" }

If the above looks easy, I have a complex layout format like the below, then How do we do, key-value mapping better and efficiently? form-037-merchant-processing-application-tell-us-

large

Thank you So much.

jyotiyadav94 commented 2 years ago

@purnasai-cyient Did you find an answer to get the KIE Output for the complex layout ?

purnasai-cyient commented 2 years ago

Not by following the above way of annotation. I changed the way I annotate. I need only a set of labels from the document.

Currently, I annotated the required text for these classes and all other text as "others" labels.

After Inference, I am doing post-processing to get those labels' text only. But I still want to know, How others approaching this with the Above annotation

jyotiyadav94 commented 2 years ago

@purnasai-cyient

Yeah I agree with few set of labels its easy to get extract the values.I haven't find a good approach for question & answer

NielsRogge commented 2 years ago

Hi,

I've uploaded some notebooks illustrating how to fine-tune LayoutLMv2/LayoutXLM for relation extraction here: https://github.com/NielsRogge/Transformers-Tutorials/tree/master/LayoutXLM

imrankh46 commented 10 months ago

Hi,

I've uploaded some notebooks illustrating how to fine-tune LayoutLMv2/LayoutXLM for relation extraction here: https://github.com/NielsRogge/Transformers-Tutorials/tree/master/LayoutXLM

hey NielsRogge, i want to get output in json formate. how i can do this? your example will be appreciated. thanks