#318·donut

ground_truth = json.loads(sample["ground_truth"]) KeyError: 'ground_truth'

Author: monarchmioCreated Oct 10, 2024Updated Jun 7, 2025

I am using a dataset that I created, and the content format of the JSON file is as follows:

{"file_name": "document_100.png", "ground_truth": "{"gt_parse": {"patient_id": 659136, "patient_name": "中村 篤司", "amount": "¥21,976.00", "date": "1983-06-13", "hospital": "東京病院", "description": "入院費用"}}"} When training, I encounter the error KeyError: 'ground_truth' when executing ground_truth = json.loads(sample["ground_truth"]). How can I resolve this issue?