{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Financial documents\n", "In this notebook we show how to read the FUNSD dataset [1]. This dataset contains annotated documents and serves as a benchmark for machine learning applied on smart documents. In the FinTorch repository, we developed the code to load the dataset and make it ready to be digested by a machine learning model. Here we discuss the dataset of the FinTorch repo in more detail." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## FUNSD dataset\n", "The dataset consists of 199 form that are annotated. Here are the complete statistics of the dataset:\n", "\n", "| | Value |\n", "|--------------------------|---------|\n", "| Fully Annotated Forms | 199 |\n", "| Total Words | 31,485 |\n", "| Semantic Entities | 9,707 |\n", "| Relations | 5,304 |\n", "\n", "An example of such an annotated form is the following:\n", "![Annotated forms](https://guillaumejaume.github.io/FUNSD/img/two_forms.png)\n", "\n", "The dataset is split into the following folder structure\n", "\n", "* **training_data** : contains the training examples\n", "* **test_data**: contains all the test examples\n", "\n", "The train and test folder contain:\n", "\n", "* **annotations**: a directory with json files\n", "* **images**: a directory with png files\n", "\n", "Next, we discuss each in more detail." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Annotation\n", "The forms are annotated and the annotations are stored in a json format.\n", "\n", "Here is an example snipped provided by Guillame et al. [1]:\n", "\n", "![](https://guillaumejaume.github.io/FUNSD/img/semantic_entity_example.png)\n", "\n", "and the corresponding `json` annotation:\n", "\n", "\n", "```json\n", " {\n", " \"form\": [\n", " {\n", " \"id\": 0,\n", " \"text\": \"Registration No.\",\n", " \"box\": [94,169,191,186],\n", " \"linking\": [\n", " [0,1]\n", " ],\n", " \"label\": \"question\",\n", " \"words\": [\n", " {\n", " \"text\": \"Registration\",\n", " \"box\": [94,169,168,186]\n", " },\n", " {\n", " \"text\": \"No.\",\n", " \"box\": [170,169,191,183]\n", " }\n", " ]\n", " },\n", " {\n", " \"id\": 1,\n", " \"text\": \"533\",\n", " \"box\": [209,169,236,182],\n", " \"label\": \"answer\",\n", " \"words\": [\n", " {\n", " \"box\": [209,169,236,182\n", " ],\n", " \"text\": \"533\"\n", " }\n", " ],\n", " \"linking\": [\n", " [0,1]\n", " ]\n", " }\n", " ]\n", " }\n", "\n", "```\n", "\n", "Below we present the structure of the json file. The json file contains a \"form\" key which captures all the annotation details of a document.\n", "The annotations consist of a *box* which are the ((x,y), (x,y)) coordinates of the annotation box, the *text* that is contained in the box, the type of annotation, e.g., question or answer in this example, and the *words* which shows each individual word and bounding box. The linking represents an *link* between two *id* fields. In this example, the link is [from:0, to:1] indicating that id:0 (question) has a directed link to id:1 (answer)." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Loading the dataset\n", "The following Python snippet demonstrates how to load the InvoiceDataset, which can be easily plugged into PyTorch DataLoaders or model training pipelines. Once you have the dataset, you can iterate through batches, transform them, and feed them into your torch models." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "INFO:root:Loading invoice dataset\n", "INFO:root:Downloading the FUNSD dataset\n", "100%|██████████| 16.8M/16.8M [00:00<00:00, 46.3MiB/s]\n", "INFO:root:Download and extraction complete\n", "INFO:root:Processing: apply transformation to FUNSD dataset\n", "INFO:root:Processing training data\n", "Processing files: 100%|██████████| 149/149 [00:03<00:00, 49.11it/s]\n", "INFO:root:Processing test data\n", "Processing files: 100%|██████████| 50/50 [00:01<00:00, 46.38it/s]\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "Length of the dataset:199 \n", " Print first 10 records:\n", "{'image': tensor([[[1., 1., 1., ..., 1., 1., 1.],\n", " [1., 1., 1., ..., 1., 1., 1.],\n", " [1., 1., 1., ..., 1., 1., 1.],\n", " ...,\n", " [1., 1., 1., ..., 1., 1., 1.],\n", " [1., 1., 1., ..., 1., 1., 1.],\n", " [1., 1., 1., ..., 1., 1., 1.]],\n", "\n", " [[1., 1., 1., ..., 1., 1., 1.],\n", " [1., 1., 1., ..., 1., 1., 1.],\n", " [1., 1., 1., ..., 1., 1., 1.],\n", " ...,\n", " [1., 1., 1., ..., 1., 1., 1.],\n", " [1., 1., 1., ..., 1., 1., 1.],\n", " [1., 1., 1., ..., 1., 1., 1.]],\n", "\n", " [[1., 1., 1., ..., 1., 1., 1.],\n", " [1., 1., 1., ..., 1., 1., 1.],\n", " [1., 1., 1., ..., 1., 1., 1.],\n", " ...,\n", " [1., 1., 1., ..., 1., 1., 1.],\n", " [1., 1., 1., ..., 1., 1., 1.],\n", " [1., 1., 1., ..., 1., 1., 1.]]]), 'meta': [{'box': [340, 110, 405, 128], 'text': 'LORILLARD', 'label': 'other', 'words': [{'box': [340, 110, 405, 128], 'text': 'LORILLARD'}], 'linking': [], 'id': 0}, {'box': [468, 190, 509, 204], 'text': 'DATE', 'label': 'question', 'words': [{'box': [468, 190, 509, 204], 'text': 'DATE'}], 'linking': [[1, 46]], 'id': 1}, {'box': [184, 219, 208, 234], 'text': '28', 'label': 'answer', 'words': [{'box': [184, 219, 208, 234], 'text': '28'}], 'linking': [[49, 2]], 'id': 2}, {'box': [99, 274, 149, 296], 'text': 'SCOPE:', 'label': 'header', 'words': [{'box': [99, 274, 149, 296], 'text': 'SCOPE:'}], 'linking': [[3, 4], [3, 5], [3, 6], [3, 39]], 'id': 3}, {'box': [221, 274, 261, 291], 'text': 'AREA', 'label': 'question', 'words': [{'box': [221, 274, 261, 291], 'text': 'AREA'}], 'linking': [[3, 4]], 'id': 4}, {'box': [308, 269, 363, 289], 'text': 'REGION', 'label': 'question', 'words': [{'box': [308, 269, 363, 289], 'text': 'REGION'}], 'linking': [[3, 5]], 'id': 5}, {'box': [410, 268, 483, 285], 'text': 'DIVISION', 'label': 'question', 'words': [{'box': [410, 268, 483, 285], 'text': 'DIVISION'}], 'linking': [[3, 6]], 'id': 6}, {'box': [513, 262, 534, 281], 'text': 'x', 'label': 'answer', 'words': [{'box': [513, 262, 534, 281], 'text': 'x'}], 'linking': [[39, 7]], 'id': 7}, {'box': [328, 361, 368, 385], 'text': 'POOR', 'label': 'question', 'words': [{'box': [328, 361, 368, 385], 'text': 'POOR'}], 'linking': [[55, 8]], 'id': 8}, {'box': [400, 360, 439, 381], 'text': 'FAIR', 'label': 'question', 'words': [{'box': [400, 360, 439, 381], 'text': 'FAIR'}], 'linking': [[55, 9]], 'id': 9}, {'box': [476, 358, 509, 383], 'text': 'GOOD', 'label': 'question', 'words': [{'box': [476, 358, 509, 383], 'text': 'GOOD'}], 'linking': [[55, 10]], 'id': 10}, {'box': [546, 356, 623, 376], 'text': 'EXCELLENT', 'label': 'question', 'words': [{'box': [546, 356, 623, 376], 'text': 'EXCELLENT'}], 'linking': [[55, 11]], 'id': 11}, {'box': [328, 406, 366, 423], 'text': 'POOR', 'label': 'question', 'words': [{'box': [328, 406, 366, 423], 'text': 'POOR'}], 'linking': [[56, 12]], 'id': 12}, {'box': [334, 442, 367, 463], 'text': 'POOR', 'label': 'question', 'words': [{'box': [334, 442, 367, 463], 'text': 'POOR'}], 'linking': [[57, 13]], 'id': 13}, {'box': [330, 483, 369, 504], 'text': 'POOR', 'label': 'question', 'words': [{'box': [330, 483, 369, 504], 'text': 'POOR'}], 'linking': [[58, 14]], 'id': 14}, {'box': [403, 402, 438, 422], 'text': 'FAIR', 'label': 'question', 'words': [{'box': [403, 402, 438, 422], 'text': 'FAIR'}], 'linking': [[15, 24], [56, 15]], 'id': 15}, {'box': [401, 441, 439, 461], 'text': 'FAIR', 'label': 'question', 'words': [{'box': [401, 441, 439, 461], 'text': 'FAIR'}], 'linking': [[16, 25], [57, 16]], 'id': 16}, {'box': [406, 482, 441, 502], 'text': 'FAIR', 'label': 'question', 'words': [{'box': [406, 482, 441, 502], 'text': 'FAIR'}], 'linking': [[17, 26], [58, 17]], 'id': 17}, {'box': [474, 399, 511, 419], 'text': 'GOOD', 'label': 'question', 'words': [{'box': [474, 399, 511, 419], 'text': 'GOOD'}], 'linking': [[56, 18]], 'id': 18}, {'box': [479, 439, 514, 460], 'text': 'GOOD', 'label': 'question', 'words': [{'box': [479, 439, 514, 460], 'text': 'GOOD'}], 'linking': [[57, 19]], 'id': 19}, {'box': [480, 479, 514, 499], 'text': 'GOOD', 'label': 'question', 'words': [{'box': [480, 479, 514, 499], 'text': 'GOOD'}], 'linking': [[58, 20]], 'id': 20}, {'box': [547, 397, 627, 417], 'text': 'EXCELLENT', 'label': 'question', 'words': [{'box': [547, 397, 627, 417], 'text': 'EXCELLENT'}], 'linking': [[56, 21]], 'id': 21}, {'box': [546, 436, 627, 456], 'text': 'EXCELLENT', 'label': 'question', 'words': [{'box': [546, 436, 627, 456], 'text': 'EXCELLENT'}], 'linking': [[57, 22]], 'id': 22}, {'box': [552, 479, 627, 498], 'text': 'EXCELLENT', 'label': 'question', 'words': [{'box': [552, 479, 627, 498], 'text': 'EXCELLENT'}], 'linking': [[58, 23]], 'id': 23}, {'box': [383, 401, 401, 418], 'text': 'x', 'label': 'answer', 'words': [{'box': [383, 401, 401, 418], 'text': 'x'}], 'linking': [[15, 24]], 'id': 24}, {'box': [382, 439, 397, 460], 'text': 'x', 'label': 'answer', 'words': [{'box': [382, 439, 397, 460], 'text': 'x'}], 'linking': [[16, 25]], 'id': 25}, {'box': [382, 481, 400, 499], 'text': 'x', 'label': 'answer', 'words': [{'box': [382, 481, 400, 499], 'text': 'x'}], 'linking': [[17, 26]], 'id': 26}, {'box': [329, 637, 376, 656], 'text': '28728', 'label': 'answer', 'words': [{'box': [329, 637, 376, 656], 'text': '28728'}], 'linking': [[61, 27]], 'id': 27}, {'box': [380, 666, 400, 685], 'text': 'x', 'label': 'answer', 'words': [{'box': [380, 666, 400, 685], 'text': 'x'}], 'linking': [[30, 28]], 'id': 28}, {'box': [387, 743, 402, 762], 'text': 'x', 'label': 'answer', 'words': [{'box': [387, 743, 402, 762], 'text': 'x'}], 'linking': [[31, 29]], 'id': 29}, {'box': [407, 666, 439, 683], 'text': 'YES', 'label': 'question', 'words': [{'box': [407, 666, 439, 683], 'text': 'YES'}], 'linking': [[62, 30], [30, 28]], 'id': 30}, {'box': [415, 744, 448, 765], 'text': 'YES', 'label': 'question', 'words': [{'box': [415, 744, 448, 765], 'text': 'YES'}], 'linking': [[63, 31], [31, 29]], 'id': 31}, {'box': [507, 742, 528, 761], 'text': 'NO', 'label': 'question', 'words': [{'box': [507, 742, 528, 761], 'text': 'NO'}], 'linking': [[63, 32]], 'id': 32}, {'box': [630, 829, 648, 895], 'text': '92094746', 'label': 'other', 'words': [{'box': [630, 829, 648, 895], 'text': '92094746'}], 'linking': [], 'id': 33}, {'box': [250, 364, 263, 381], 'text': 'N/', 'label': 'other', 'words': [{'box': [250, 364, 263, 381], 'text': 'N/'}], 'linking': [], 'id': 34}, {'box': [263, 367, 281, 382], 'text': 'A', 'label': 'other', 'words': [{'box': [263, 367, 281, 382], 'text': 'A'}], 'linking': [], 'id': 35}, {'box': [496, 665, 527, 683], 'text': 'NO*', 'label': 'question', 'words': [{'box': [496, 665, 527, 683], 'text': 'NO*'}], 'linking': [[62, 36]], 'id': 36}, {'box': [110, 702, 187, 719], 'text': '*EXPLAIN:', 'label': 'question', 'words': [{'box': [110, 702, 187, 719], 'text': '*EXPLAIN:'}], 'linking': [], 'id': 37}, {'box': [104, 525, 184, 549], 'text': 'COMMENTS:', 'label': 'question', 'words': [{'box': [104, 525, 184, 549], 'text': 'COMMENTS:'}], 'linking': [[38, 59], [38, 60]], 'id': 38}, {'box': [545, 263, 596, 284], 'text': 'OTHER*', 'label': 'question', 'words': [{'box': [545, 263, 596, 284], 'text': 'OTHER*'}], 'linking': [[3, 39], [39, 7]], 'id': 39}, {'box': [106, 301, 174, 321], 'text': '*EXPLAIN:', 'label': 'question', 'words': [{'box': [106, 301, 174, 321], 'text': '*EXPLAIN:'}], 'linking': [[40, 54]], 'id': 40}, {'text': '09/ 08/ 95 16: 17', 'box': [64, 114, 167, 130], 'linking': [], 'label': 'other', 'words': [{'text': '09/', 'box': [64, 114, 77, 129]}, {'text': '08/', 'box': [78, 115, 98, 128]}, {'text': '95', 'box': [99, 115, 116, 130]}, {'text': '16:', 'box': [127, 114, 144, 127]}, {'text': '17', 'box': [146, 114, 167, 127]}], 'id': 41}, {'text': '214 340 9308', 'box': [186, 111, 281, 130], 'linking': [], 'label': 'other', 'words': [{'text': '214', 'box': [186, 111, 225, 128]}, {'text': '340', 'box': [223, 112, 247, 130]}, {'text': '9308', 'box': [243, 112, 281, 126]}], 'id': 42}, {'text': 'NYO SLS GEN', 'box': [443, 108, 543, 128], 'linking': [], 'label': 'other', 'words': [{'text': '', 'box': [443, 114, 469, 125]}, {'text': 'NYO', 'box': [469, 112, 494, 125]}, {'text': 'SLS', 'box': [496, 108, 518, 127]}, {'text': 'GEN', 'box': [525, 110, 543, 128]}], 'id': 43}, {'text': '00 /003', 'box': [580, 108, 644, 125], 'linking': [], 'label': 'other', 'words': [{'text': '00', 'box': [580, 108, 617, 125]}, {'text': '/003', 'box': [616, 112, 644, 125]}], 'id': 44}, {'text': 'SPECIAL PROMOTION EVALUATION', 'box': [248, 134, 474, 158], 'linking': [], 'label': 'header', 'words': [{'text': 'SPECIAL', 'box': [248, 139, 307, 158]}, {'text': 'PROMOTION', 'box': [314, 138, 389, 158]}, {'text': 'EVALUATION', 'box': [390, 134, 474, 154]}], 'id': 45}, {'text': '9 /8 /95', 'box': [454, 166, 502, 191], 'linking': [[1, 46]], 'label': 'answer', 'words': [{'text': '9', 'box': [454, 170, 465, 187]}, {'text': '/8', 'box': [463, 166, 478, 191]}, {'text': '/95', 'box': [481, 170, 502, 188]}], 'id': 46}, {'text': 'AREA/ REGION/ DIVISION', 'box': [93, 192, 265, 217], 'linking': [[47, 48]], 'label': 'question', 'words': [{'text': 'AREA/', 'box': [93, 197, 135, 216]}, {'text': 'REGION/', 'box': [139, 193, 193, 217]}, {'text': 'DIVISION', 'box': [197, 192, 265, 213]}], 'id': 47}, {'text': '2 13', 'box': [111, 182, 186, 197], 'linking': [[47, 48]], 'label': 'answer', 'words': [{'text': '2', 'box': [111, 182, 133, 197]}, {'text': '13', 'box': [157, 182, 186, 194]}], 'id': 48}, {'text': 'PROMO #', 'box': [97, 223, 161, 245], 'linking': [[49, 2]], 'label': 'question', 'words': [{'text': 'PROMO', 'box': [97, 223, 148, 245]}, {'text': '#', 'box': [149, 223, 161, 244]}], 'id': 49}, {'text': 'PROMOTIONAL PERIOD:', 'box': [317, 213, 471, 239], 'linking': [[50, 51]], 'label': 'question', 'words': [{'text': 'PROMOTIONAL', 'box': [317, 215, 405, 239]}, {'text': 'PERIOD:', 'box': [412, 213, 471, 234]}], 'id': 50}, {'text': 'June/ July', 'box': [508, 203, 572, 227], 'linking': [[50, 51]], 'label': 'answer', 'words': [{'text': 'June/', 'box': [508, 206, 541, 227]}, {'text': 'July', 'box': [544, 203, 572, 227]}], 'id': 51}, {'text': 'ITEM/ BRAND:', 'box': [100, 246, 188, 270], 'linking': [[52, 53]], 'label': 'question', 'words': [{'text': 'ITEM/', 'box': [100, 249, 139, 270]}, {'text': 'BRAND:', 'box': [144, 246, 188, 267]}], 'id': 52}, {'text': 'Sunglasses / Newport', 'box': [218, 238, 362, 263], 'linking': [[52, 53]], 'label': 'answer', 'words': [{'text': 'Sunglasses', 'box': [218, 245, 296, 258]}, {'text': '/', 'box': [297, 239, 309, 263]}, {'text': 'Newport', 'box': [310, 238, 362, 256]}], 'id': 53}, {'text': 'Special Emphasis Calls', 'box': [197, 297, 343, 318], 'linking': [[40, 54]], 'label': 'answer', 'words': [{'text': 'Special', 'box': [197, 300, 249, 317]}, {'text': 'Emphasis', 'box': [251, 297, 311, 314]}, {'text': 'Calls', 'box': [309, 298, 343, 318]}], 'id': 54}, {'text': 'CHAIN ACCEPTANCE:', 'box': [100, 364, 242, 389], 'linking': [[55, 8], [55, 9], [55, 10], [55, 11]], 'label': 'header', 'words': [{'text': 'CHAIN', 'box': [100, 368, 148, 386]}, {'text': 'ACCEPTANCE:', 'box': [152, 364, 242, 389]}], 'id': 55}, {'text': 'INDEPENDENT ACCEPTANCE:', 'box': [101, 407, 293, 428], 'linking': [[56, 12], [56, 15], [56, 18], [56, 21]], 'label': 'header', 'words': [{'text': 'INDEPENDENT', 'box': [101, 409, 197, 428]}, {'text': 'ACCEPTANCE:', 'box': [203, 407, 293, 426]}], 'id': 56}, {'text': 'CONSUMER ACCEPTANCE:', 'box': [106, 439, 269, 468], 'linking': [[57, 13], [57, 16], [57, 19], [57, 22]], 'label': 'header', 'words': [{'text': 'CONSUMER', 'box': [106, 443, 176, 468]}, {'text': 'ACCEPTANCE:', 'box': [182, 439, 269, 467]}], 'id': 57}, {'text': 'EFFICIENCY RATING:', 'box': [105, 482, 254, 508], 'linking': [[58, 14], [58, 17], [58, 20], [58, 23]], 'label': 'header', 'words': [{'text': 'EFFICIENCY', 'box': [105, 486, 191, 508]}, {'text': 'RATING:', 'box': [196, 482, 254, 506]}], 'id': 58}, {'text': 'This item was perceived by retailers and consumers as a low', 'box': [195, 517, 590, 540], 'linking': [[38, 59]], 'label': 'answer', 'words': [{'text': 'This', 'box': [195, 526, 229, 540]}, {'text': 'item', 'box': [235, 526, 264, 540]}, {'text': 'was', 'box': [267, 522, 288, 536]}, {'text': 'perceived', 'box': [294, 525, 353, 540]}, {'text': 'by', 'box': [356, 521, 373, 539]}, {'text': 'retailers', 'box': [380, 519, 435, 539]}, {'text': 'and', 'box': [441, 522, 465, 534]}, {'text': 'consumers', 'box': [468, 518, 531, 535]}, {'text': 'as', 'box': [535, 517, 550, 532]}, {'text': 'a', 'box': [553, 520, 566, 531]}, {'text': 'low', 'box': [568, 517, 590, 532]}], 'id': 59}, {'text': 'quality item. Several Sales Reps reported that on occasion our consumers would pass up the deal or leave the glasses in the store.', 'box': [107, 541, 590, 594], 'linking': [[38, 60]], 'label': 'answer', 'words': [{'text': 'quality', 'box': [107, 554, 159, 569]}, {'text': 'item.', 'box': [163, 551, 194, 569]}, {'text': 'Several', 'box': [206, 551, 257, 565]}, {'text': 'Sales', 'box': [258, 548, 297, 565]}, {'text': 'Reps', 'box': [301, 546, 330, 563]}, {'text': 'reported', 'box': [333, 546, 388, 563]}, {'text': 'that', 'box': [393, 544, 418, 563]}, {'text': 'on', 'box': [425, 545, 439, 560]}, {'text': 'occasion', 'box': [443, 542, 498, 559]}, {'text': 'our', 'box': [504, 544, 525, 558]}, {'text': 'consumers', 'box': [531, 541, 590, 558]}, {'text': 'would', 'box': [107, 579, 146, 593]}, {'text': 'pass', 'box': [151, 581, 177, 594]}, {'text': 'up', 'box': [182, 578, 199, 593]}, {'text': 'the', 'box': [203, 575, 224, 593]}, {'text': 'deal', 'box': [228, 574, 254, 591]}, {'text': 'or', 'box': [261, 577, 279, 591]}, {'text': 'leave', 'box': [282, 573, 316, 592]}, {'text': 'the', 'box': [321, 570, 340, 589]}, {'text': 'glasses', 'box': [347, 574, 395, 588]}, {'text': 'in', 'box': [395, 570, 415, 588]}, {'text': 'the', 'box': [420, 572, 439, 586]}, {'text': 'store.', 'box': [446, 570, 485, 587]}], 'id': 60}, {'text': '#ITEMS/ DEALS RECEIVED:', 'box': [112, 645, 290, 663], 'linking': [[61, 27]], 'label': 'question', 'words': [{'text': '#ITEMS/', 'box': [112, 649, 160, 663]}, {'text': '', 'box': [156, 645, 169, 660]}, {'text': 'DEALS', 'box': [167, 645, 213, 663]}, {'text': 'RECEIVED:', 'box': [217, 646, 290, 660]}], 'id': 61}, {'text': 'WERE QUANTITIES APPROPRIATE?', 'box': [110, 669, 339, 690], 'linking': [[62, 30], [62, 36]], 'label': 'header', 'words': [{'text': 'WERE', 'box': [110, 673, 147, 690]}, {'text': 'QUANTITIES', 'box': [153, 672, 237, 690]}, {'text': 'APPROPRIATE?', 'box': [243, 669, 339, 688]}], 'id': 62}, {'text': 'SHOULD PROMOTION BE REPEATED', 'box': [111, 749, 349, 771], 'linking': [[63, 31], [63, 32]], 'label': 'header', 'words': [{'text': 'SHOULD', 'box': [111, 754, 164, 771]}, {'text': 'PROMOTION', 'box': [172, 751, 245, 770]}, {'text': 'BE', 'box': [252, 751, 271, 768]}, {'text': 'REPEATED', 'box': [276, 749, 349, 768]}], 'id': 63}, {'text': 'IF NO, EXPLAIN:', 'box': [113, 776, 233, 796], 'linking': [], 'label': 'question', 'words': [{'text': 'IF', 'box': [113, 779, 131, 793]}, {'text': 'NO,', 'box': [140, 781, 164, 796]}, {'text': 'EXPLAIN:', 'box': [169, 776, 233, 794]}], 'id': 64}, {'text': 'IF YES, CAN IT BE IMPROVED?', 'box': [113, 828, 334, 851], 'linking': [[65, 66], [65, 67]], 'label': 'question', 'words': [{'text': 'IF', 'box': [113, 831, 134, 849]}, {'text': 'YES,', 'box': [139, 834, 172, 851]}, {'text': 'CAN', 'box': [182, 829, 207, 849]}, {'text': 'IT', 'box': [211, 830, 233, 844]}, {'text': 'BE', 'box': [239, 829, 257, 846]}, {'text': 'IMPROVED?', 'box': [262, 828, 334, 847]}], 'id': 65}, {'text': 'The Promotion can be improved by upgrading', 'box': [353, 818, 630, 840], 'linking': [[65, 66]], 'label': 'answer', 'words': [{'text': 'The', 'box': [353, 824, 375, 839]}, {'text': 'Promotion', 'box': [377, 824, 438, 838]}, {'text': 'can', 'box': [442, 822, 464, 840]}, {'text': 'be', 'box': [468, 820, 483, 835]}, {'text': 'improved', 'box': [489, 822, 544, 837]}, {'text': 'by', 'box': [547, 821, 564, 836]}, {'text': 'upgrading', 'box': [570, 818, 630, 836]}], 'id': 66}, {'text': 'the quality of the sunglasses', 'box': [116, 854, 315, 874], 'linking': [[65, 67]], 'label': 'answer', 'words': [{'text': 'the', 'box': [116, 860, 140, 874]}, {'text': 'quality', 'box': [144, 857, 191, 872]}, {'text': 'of', 'box': [191, 855, 215, 874]}, {'text': 'the', 'box': [219, 854, 238, 868]}, {'text': 'sunglasses', 'box': [243, 854, 315, 869]}], 'id': 67}]}\n", "{'image': tensor([[[0., 0., 0., ..., 1., 1., 1.],\n", " [0., 0., 0., ..., 1., 1., 1.],\n", " [0., 0., 0., ..., 1., 1., 1.],\n", " ...,\n", " [1., 1., 1., ..., 1., 1., 1.],\n", " [1., 1., 1., ..., 1., 1., 1.],\n", " [1., 1., 1., ..., 1., 1., 1.]],\n", "\n", " [[0., 0., 0., ..., 1., 1., 1.],\n", " [0., 0., 0., ..., 1., 1., 1.],\n", " [0., 0., 0., ..., 1., 1., 1.],\n", " ...,\n", " [1., 1., 1., ..., 1., 1., 1.],\n", " [1., 1., 1., ..., 1., 1., 1.],\n", " [1., 1., 1., ..., 1., 1., 1.]],\n", "\n", " [[0., 0., 0., ..., 1., 1., 1.],\n", " [0., 0., 0., ..., 1., 1., 1.],\n", " [0., 0., 0., ..., 1., 1., 1.],\n", " ...,\n", " [1., 1., 1., ..., 1., 1., 1.],\n", " [1., 1., 1., ..., 1., 1., 1.],\n", " [1., 1., 1., ..., 1., 1., 1.]]]), 'meta': [{'box': [627, 51, 666, 65], 'text': '0465E', 'label': 'other', 'words': [{'box': [627, 51, 666, 65], 'text': '0465E'}], 'linking': [], 'id': 0}, {'box': [338, 126, 379, 142], 'text': '($000)', 'label': 'other', 'words': [{'box': [338, 126, 379, 142], 'text': '($000)'}], 'linking': [], 'id': 1}, {'box': [49, 147, 83, 157], 'text': 'Title', 'label': 'question', 'words': [{'box': [49, 147, 83, 157], 'text': 'Title'}], 'linking': [[2, 64]], 'id': 2}, {'box': [46, 176, 96, 188], 'text': 'Purpose', 'label': 'header', 'words': [{'box': [46, 176, 96, 188], 'text': 'Purpose'}], 'linking': [[3, 65], [3, 66], [3, 67], [3, 68], [3, 69], [3, 70], [3, 71]], 'id': 3}, {'box': [75, 193, 85, 204], 'text': '1', 'label': 'question', 'words': [{'box': [75, 193, 85, 204], 'text': '1'}], 'linking': [], 'id': 4}, {'box': [74, 207, 84, 219], 'text': '2', 'label': 'question', 'words': [{'box': [74, 207, 84, 219], 'text': '2'}], 'linking': [], 'id': 5}, {'box': [74, 221, 84, 235], 'text': '3', 'label': 'question', 'words': [{'box': [74, 221, 84, 235], 'text': '3'}], 'linking': [], 'id': 6}, {'box': [74, 236, 85, 247], 'text': '4', 'label': 'question', 'words': [{'box': [74, 236, 85, 247], 'text': '4'}], 'linking': [], 'id': 7}, {'box': [365, 237, 377, 252], 'text': '7', 'label': 'question', 'words': [{'box': [365, 237, 377, 252], 'text': '7'}], 'linking': [], 'id': 8}, {'box': [364, 197, 375, 211], 'text': '5', 'label': 'question', 'words': [{'box': [364, 197, 375, 211], 'text': '5'}], 'linking': [], 'id': 9}, {'box': [365, 212, 380, 222], 'text': '6', 'label': 'question', 'words': [{'box': [365, 212, 380, 222], 'text': '6'}], 'linking': [], 'id': 10}, {'box': [46, 259, 91, 271], 'text': 'Status', 'label': 'header', 'words': [{'box': [46, 259, 91, 271], 'text': 'Status'}], 'linking': [[11, 12], [11, 13]], 'id': 11}, {'box': [202, 277, 262, 291], 'text': 'Proposed', 'label': 'question', 'words': [{'box': [202, 277, 262, 291], 'text': 'Proposed'}], 'linking': [[11, 12], [12, 26]], 'id': 12}, {'box': [206, 292, 268, 306], 'text': 'Approved;', 'label': 'question', 'words': [{'box': [206, 292, 268, 306], 'text': 'Approved;'}], 'linking': [[11, 13]], 'id': 13}, {'box': [468, 281, 508, 293], 'text': 'TOTAL', 'label': 'question', 'words': [{'box': [468, 281, 508, 293], 'text': 'TOTAL'}], 'linking': [[14, 27], [74, 14]], 'id': 14}, {'box': [539, 282, 590, 296], 'text': 'CAPITAL', 'label': 'question', 'words': [{'box': [539, 282, 590, 296], 'text': 'CAPITAL'}], 'linking': [[15, 28], [74, 15]], 'id': 15}, {'box': [612, 283, 663, 295], 'text': 'EXPENSE', 'label': 'question', 'words': [{'box': [612, 283, 663, 295], 'text': 'EXPENSE'}], 'linking': [[16, 29], [74, 16]], 'id': 16}, {'box': [481, 335, 556, 347], 'text': 'Completion', 'label': 'question', 'words': [{'box': [481, 335, 556, 347], 'text': 'Completion'}], 'linking': [[17, 31], [17, 30]], 'id': 17}, {'box': [569, 352, 593, 364], 'text': 'Mo.', 'label': 'question', 'words': [{'box': [569, 352, 593, 364], 'text': 'Mo.'}], 'linking': [[18, 31]], 'id': 18}, {'box': [625, 352, 650, 364], 'text': 'Yr.', 'label': 'question', 'words': [{'box': [625, 352, 650, 364], 'text': 'Yr.'}], 'linking': [[19, 30]], 'id': 19}, {'box': [162, 333, 231, 345], 'text': 'Submission', 'label': 'question', 'words': [{'box': [162, 333, 231, 345], 'text': 'Submission'}], 'linking': [[20, 25]], 'id': 20}, {'box': [248, 347, 272, 361], 'text': 'Yr.', 'label': 'question', 'words': [{'box': [248, 347, 272, 361], 'text': 'Yr.'}], 'linking': [], 'id': 21}, {'box': [312, 333, 346, 348], 'text': 'Start', 'label': 'question', 'words': [{'box': [312, 333, 346, 348], 'text': 'Start'}], 'linking': [[22, 33], [22, 32]], 'id': 22}, {'box': [365, 349, 387, 361], 'text': 'Mo.', 'label': 'question', 'words': [{'box': [365, 349, 387, 361], 'text': 'Mo.'}], 'linking': [[23, 23], [23, 23], [23, 33]], 'id': 23}, {'box': [423, 350, 443, 364], 'text': 'Yr.', 'label': 'question', 'words': [{'box': [423, 350, 443, 364], 'text': 'Yr.'}], 'linking': [[24, 32]], 'id': 24}, {'box': [251, 330, 266, 345], 'text': '88', 'label': 'answer', 'words': [{'box': [251, 330, 266, 345], 'text': '88'}], 'linking': [[20, 25]], 'id': 25}, {'box': [183, 276, 195, 287], 'text': 'x', 'label': 'answer', 'words': [{'box': [183, 276, 195, 287], 'text': 'x'}], 'linking': [[12, 26]], 'id': 26}, {'box': [490, 296, 507, 310], 'text': '80', 'label': 'answer', 'words': [{'box': [490, 296, 507, 310], 'text': '80'}], 'linking': [[14, 27]], 'id': 27}, {'box': [565, 296, 582, 311], 'text': '80', 'label': 'answer', 'words': [{'box': [565, 296, 582, 311], 'text': '80'}], 'linking': [[15, 28]], 'id': 28}, {'box': [636, 297, 651, 309], 'text': '0', 'label': 'answer', 'words': [{'box': [636, 297, 651, 309], 'text': '0'}], 'linking': [[16, 29]], 'id': 29}, {'box': [627, 337, 643, 347], 'text': '88', 'label': 'answer', 'words': [{'box': [627, 337, 643, 347], 'text': '88'}], 'linking': [[17, 30], [19, 30]], 'id': 30}, {'box': [574, 335, 588, 347], 'text': '11', 'label': 'answer', 'words': [{'box': [574, 335, 588, 347], 'text': '11'}], 'linking': [[17, 31], [18, 31]], 'id': 31}, {'box': [420, 333, 436, 348], 'text': '88', 'label': 'answer', 'words': [{'box': [420, 333, 436, 348], 'text': '88'}], 'linking': [[22, 32], [24, 32]], 'id': 32}, {'box': [372, 334, 386, 346], 'text': '7', 'label': 'answer', 'words': [{'box': [372, 334, 386, 346], 'text': '7'}], 'linking': [[22, 33], [23, 33]], 'id': 33}, {'box': [431, 617, 481, 631], 'text': 'CAPITAL', 'label': 'question', 'words': [{'box': [431, 617, 481, 631], 'text': 'CAPITAL'}], 'linking': [[79, 34]], 'id': 34}, {'box': [433, 630, 482, 642], 'text': 'EXPENSE', 'label': 'question', 'words': [{'box': [433, 630, 482, 642], 'text': 'EXPENSE'}], 'linking': [[79, 35]], 'id': 35}, {'box': [65, 616, 115, 626], 'text': 'CAPITAL', 'label': 'question', 'words': [{'box': [65, 616, 115, 626], 'text': 'CAPITAL'}], 'linking': [[36, 39]], 'id': 36}, {'box': [65, 630, 112, 641], 'text': 'EXPENSE', 'label': 'question', 'words': [{'box': [65, 630, 112, 641], 'text': 'EXPENSE'}], 'linking': [[37, 40]], 'id': 37}, {'box': [147, 600, 176, 612], 'text': '1989', 'label': 'answer', 'words': [{'box': [147, 600, 176, 612], 'text': '1989'}], 'linking': [[80, 38]], 'id': 38}, {'box': [146, 617, 162, 626], 'text': '80', 'label': 'answer', 'words': [{'box': [146, 617, 162, 626], 'text': '80'}], 'linking': [[36, 39]], 'id': 39}, {'box': [153, 631, 162, 641], 'text': '0', 'label': 'answer', 'words': [{'box': [153, 631, 162, 641], 'text': '0'}], 'linking': [[37, 40]], 'id': 40}, {'box': [105, 709, 132, 721], 'text': 'JAN.', 'label': 'question', 'words': [{'box': [105, 709, 132, 721], 'text': 'JAN.'}], 'linking': [], 'id': 41}, {'box': [132, 709, 167, 721], 'text': '-MAR.', 'label': 'question', 'words': [{'box': [132, 709, 167, 721], 'text': '-MAR.'}], 'linking': [], 'id': 42}, {'box': [178, 709, 208, 721], 'text': 'APR.', 'label': 'question', 'words': [{'box': [178, 709, 208, 721], 'text': 'APR.'}], 'linking': [], 'id': 43}, {'box': [208, 709, 240, 721], 'text': '-JUN.', 'label': 'question', 'words': [{'box': [208, 709, 240, 721], 'text': '-JUN.'}], 'linking': [], 'id': 44}, {'box': [252, 712, 282, 721], 'text': 'JUL.', 'label': 'question', 'words': [{'box': [252, 712, 282, 721], 'text': 'JUL.'}], 'linking': [], 'id': 45}, {'box': [357, 712, 391, 723], 'text': '-DEC', 'label': 'question', 'words': [{'box': [357, 712, 391, 723], 'text': '-DEC'}], 'linking': [], 'id': 46}, {'box': [419, 714, 453, 724], 'text': 'TOTAL', 'label': 'question', 'words': [{'box': [419, 714, 453, 724], 'text': 'TOTAL'}], 'linking': [], 'id': 47}, {'box': [42, 763, 92, 778], 'text': 'EXPENSE', 'label': 'question', 'words': [{'box': [42, 763, 92, 778], 'text': 'EXPENSE'}], 'linking': [], 'id': 48}, {'box': [42, 737, 92, 752], 'text': 'CAPITAL', 'label': 'question', 'words': [{'box': [42, 737, 92, 752], 'text': 'CAPITAL'}], 'linking': [], 'id': 49}, {'box': [282, 712, 317, 722], 'text': '-SEP', 'label': 'question', 'words': [{'box': [282, 712, 317, 722], 'text': '-SEP'}], 'linking': [], 'id': 50}, {'box': [329, 712, 356, 722], 'text': 'OCT.', 'label': 'question', 'words': [{'box': [329, 712, 356, 722], 'text': 'OCT.'}], 'linking': [], 'id': 51}, {'box': [495, 673, 521, 685], 'text': 'YEAR', 'label': 'question', 'words': [{'box': [495, 673, 521, 685], 'text': 'YEAR'}], 'linking': [[52, 55], [52, 56], [52, 57], [52, 58], [52, 85]], 'id': 52}, {'box': [616, 673, 666, 685], 'text': 'EXPENSE', 'label': 'question', 'words': [{'box': [616, 673, 666, 685], 'text': 'EXPENSE'}], 'linking': [], 'id': 53}, {'box': [549, 673, 596, 683], 'text': 'CAPITAL', 'label': 'question', 'words': [{'box': [549, 673, 596, 683], 'text': 'CAPITAL'}], 'linking': [], 'id': 54}, {'box': [495, 711, 522, 728], 'text': '1990', 'label': 'answer', 'words': [{'box': [495, 711, 522, 728], 'text': '1990'}], 'linking': [[52, 55]], 'id': 55}, {'box': [494, 739, 521, 750], 'text': '1991', 'label': 'answer', 'words': [{'box': [494, 739, 521, 750], 'text': '1991'}], 'linking': [[52, 56]], 'id': 56}, {'box': [493, 767, 522, 778], 'text': '1992', 'label': 'answer', 'words': [{'box': [493, 767, 522, 778], 'text': '1992'}], 'linking': [[52, 57]], 'id': 57}, {'box': [493, 794, 523, 805], 'text': '1993', 'label': 'answer', 'words': [{'box': [493, 794, 523, 805], 'text': '1993'}], 'linking': [[52, 58]], 'id': 58}, {'box': [525, 897, 630, 917], 'text': '621099940J', 'label': 'other', 'words': [{'box': [525, 897, 630, 917], 'text': '621099940J'}], 'linking': [], 'id': 59}, {'text': 'FA 956 (5- 85) g1 0081. (d)', 'box': [41, 36, 125, 67], 'linking': [], 'label': 'other', 'words': [{'text': 'FA', 'box': [41, 39, 58, 51]}, {'text': '956', 'box': [61, 36, 83, 52]}, {'text': '(5-', 'box': [85, 40, 104, 52]}, {'text': '85)', 'box': [103, 39, 125, 50]}, {'text': 'g1', 'box': [42, 52, 56, 66]}, {'text': '0081.', 'box': [61, 51, 100, 66]}, {'text': '(d)', 'box': [103, 52, 124, 67]}], 'id': 60}, {'text': 'BROWN & WILLIAMSON TOBACCO CORPORATION CAPITAL BUDGET PROJECT R&D', 'box': [231, 57, 497, 114], 'linking': [], 'label': 'header', 'words': [{'text': 'BROWN', 'box': [231, 57, 270, 69]}, {'text': '&', 'box': [269, 57, 283, 69]}, {'text': 'WILLIAMSON', 'box': [286, 59, 358, 70]}, {'text': 'TOBACCO', 'box': [362, 60, 414, 70]}, {'text': 'CORPORATION', 'box': [418, 61, 497, 75]}, {'text': 'CAPITAL', 'box': [286, 71, 335, 85]}, {'text': 'BUDGET', 'box': [339, 72, 383, 86]}, {'text': 'PROJECT', 'box': [389, 72, 438, 87]}, {'text': 'R&D', 'box': [345, 100, 372, 114]}], 'id': 61}, {'text': 'Date Submitted', 'box': [560, 128, 656, 145], 'linking': [], 'label': 'question', 'words': [{'text': 'Date', 'box': [560, 128, 591, 143]}, {'text': 'Submitted', 'box': [594, 130, 656, 145]}], 'id': 62}, {'text': 'Capital Budget', 'box': [61, 122, 161, 136], 'linking': [], 'label': 'question', 'words': [{'text': 'Capital', 'box': [61, 122, 112, 134]}, {'text': 'Budget', 'box': [116, 122, 161, 136]}], 'id': 63}, {'text': 'CICARETTE TEST STATION (CT5400)', 'box': [76, 165, 288, 180], 'linking': [[2, 64]], 'label': 'answer', 'words': [{'text': 'CICARETTE', 'box': [76, 165, 142, 177]}, {'text': 'TEST', 'box': [146, 166, 173, 177]}, {'text': 'STATION', 'box': [178, 167, 228, 177]}, {'text': '(CT5400)', 'box': [233, 166, 288, 180]}], 'id': 64}, {'text': 'Maintenance of Existing Business', 'box': [113, 192, 336, 209], 'linking': [[3, 65]], 'label': 'question', 'words': [{'text': 'Maintenance', 'box': [113, 193, 195, 204]}, {'text': 'of', 'box': [197, 193, 212, 208]}, {'text': 'Existing', 'box': [217, 192, 273, 209]}, {'text': 'Business', 'box': [277, 196, 336, 208]}], 'id': 65}, {'text': 'Expansion of Existing Business', 'box': [116, 206, 322, 224], 'linking': [[3, 66]], 'label': 'question', 'words': [{'text': 'Expansion', 'box': [116, 206, 180, 218]}, {'text': 'of', 'box': [183, 209, 197, 220]}, {'text': 'Existing', 'box': [206, 207, 261, 224]}, {'text': 'Business', 'box': [266, 208, 322, 220]}], 'id': 66}, {'text': 'New Products', 'box': [115, 221, 200, 233], 'linking': [[3, 67]], 'label': 'question', 'words': [{'text': 'New', 'box': [115, 221, 140, 232]}, {'text': 'Products', 'box': [145, 222, 200, 233]}], 'id': 67}, {'text': 'Cost Reduction', 'box': [117, 234, 218, 251], 'linking': [[3, 68]], 'label': 'question', 'words': [{'text': 'Cost', 'box': [117, 234, 142, 249]}, {'text': 'Reduction', 'box': [153, 236, 218, 251]}], 'id': 68}, {'text': 'Compliance with Outside Requirements', 'box': [406, 198, 658, 215], 'linking': [[3, 69]], 'label': 'question', 'words': [{'text': 'Compliance', 'box': [406, 200, 478, 211]}, {'text': 'with', 'box': [483, 201, 515, 212]}, {'text': 'Outside', 'box': [516, 198, 567, 210]}, {'text': 'Requirements', 'box': [572, 200, 658, 215]}], 'id': 69}, {'text': 'Company Improvements & Administrative Requirements', 'box': [408, 212, 663, 241], 'linking': [[3, 70]], 'label': 'question', 'words': [{'text': 'Company', 'box': [408, 214, 459, 225]}, {'text': 'Improvements', 'box': [465, 212, 549, 224]}, {'text': '&', 'box': [551, 213, 563, 227]}, {'text': 'Administrative', 'box': [566, 216, 663, 230]}, {'text': 'Requirements', 'box': [421, 227, 510, 241]}], 'id': 70}, {'text': 'Quality Improvement', 'box': [408, 238, 540, 254], 'linking': [[3, 71]], 'label': 'question', 'words': [{'text': 'Quality', 'box': [408, 238, 458, 252]}, {'text': 'Improvement', 'box': [465, 239, 540, 254]}], 'id': 71}, {'text': 'This Project is', 'box': [66, 276, 173, 292], 'linking': [], 'label': 'question', 'words': [{'text': 'This', 'box': [66, 276, 98, 290]}, {'text': 'Project', 'box': [103, 276, 150, 292]}, {'text': 'is', 'box': [157, 276, 173, 290]}], 'id': 72}, {'text': 'Proposal No.', 'box': [272, 291, 354, 306], 'linking': [], 'label': 'question', 'words': [{'text': 'Proposal', 'box': [272, 291, 329, 306]}, {'text': 'No.', 'box': [332, 296, 354, 306]}], 'id': 73}, {'text': 'Estimate Cost', 'box': [456, 264, 546, 275], 'linking': [[74, 14], [74, 15], [74, 16]], 'label': 'header', 'words': [{'text': 'Estimate', 'box': [456, 264, 513, 275]}, {'text': 'Cost', 'box': [519, 264, 546, 275]}], 'id': 74}, {'text': 'Project Dates', 'box': [41, 315, 132, 327], 'linking': [], 'label': 'header', 'words': [{'text': 'Project', 'box': [41, 315, 90, 327]}, {'text': 'Dates', 'box': [96, 317, 132, 327]}], 'id': 75}, {'text': 'PROJECT DESCRIPTION', 'box': [45, 369, 181, 385], 'linking': [[76, 77]], 'label': 'question', 'words': [{'text': 'PROJECT', 'box': [45, 369, 96, 385]}, {'text': 'DESCRIPTION', 'box': [102, 369, 181, 385]}], 'id': 76}, {'text': 'The Cigarette Test Station (CTS400) combines many of the stand- alone instruments that R&D currently uses to measure cigarette weight, pressure drop, ventilation, and hardness into one compact module. The CTS400 has the additional measurement of cigarette hardness in comparison with the CTS300. With this added, measurement R&D will be able to replace the Firmness Integrator that measures cigarette firmness in addition to other measurements that are mentioned above. The Firmness Integrator is no longer manufactured and parts are becoming difficult to obtain. Lastly, purchase of this instrument would provide similar capability as the Macon Plant and help facilitate comparisions between laboratories.', 'box': [65, 399, 661, 523], 'linking': [[76, 77]], 'label': 'answer', 'words': [{'text': 'The', 'box': [66, 399, 90, 410]}, {'text': 'Cigarette', 'box': [95, 399, 157, 413]}, {'text': 'Test', 'box': [162, 401, 191, 411]}, {'text': 'Station', 'box': [197, 399, 251, 410]}, {'text': '(CTS400)', 'box': [252, 399, 307, 416]}, {'text': 'combines', 'box': [313, 401, 370, 417]}, {'text': 'many', 'box': [372, 404, 403, 415]}, {'text': 'of', 'box': [408, 404, 424, 415]}, {'text': 'the', 'box': [429, 403, 448, 417]}, {'text': 'stand-', 'box': [455, 404, 496, 415]}, {'text': 'alone', 'box': [498, 404, 532, 415]}, {'text': 'instruments', 'box': [541, 405, 615, 416]}, {'text': 'that', 'box': [618, 404, 647, 416]}, {'text': 'R&D', 'box': [67, 414, 92, 423]}, {'text': 'currently', 'box': [95, 415, 157, 426]}, {'text': 'uses', 'box': [163, 415, 192, 425]}, {'text': 'to', 'box': [197, 415, 214, 427]}, {'text': 'measure', 'box': [214, 415, 265, 425]}, {'text': 'cigarette', 'box': [269, 416, 334, 427]}, {'text': 'weight,', 'box': [339, 418, 379, 429]}, {'text': '', 'box': [380, 420, 387, 430]}, {'text': 'pressure', 'box': [390, 415, 452, 430]}, {'text': 'drop,', 'box': [455, 416, 491, 430]}, {'text': 'ventilation,', 'box': [496, 418, 577, 432]}, {'text': 'and', 'box': [584, 418, 610, 430]}, {'text': 'hardness', 'box': [67, 425, 122, 440]}, {'text': 'into', 'box': [127, 429, 157, 439]}, {'text': 'one', 'box': [162, 429, 187, 439]}, {'text': 'compact', 'box': [192, 429, 237, 441]}, {'text': 'module.', 'box': [244, 430, 291, 440]}, {'text': 'The', 'box': [305, 429, 327, 440]}, {'text': 'CTS400', 'box': [333, 430, 377, 442]}, {'text': 'has', 'box': [379, 433, 403, 442]}, {'text': 'the', 'box': [409, 430, 428, 442]}, {'text': 'additional', 'box': [436, 433, 505, 444]}, {'text': 'measurement', 'box': [509, 434, 588, 445]}, {'text': 'of', 'box': [591, 434, 608, 444]}, {'text': 'cigarette', 'box': [67, 439, 129, 453]}, {'text': 'hardness', 'box': [135, 439, 192, 453]}, {'text': 'in', 'box': [197, 443, 213, 454]}, {'text': 'comparison', 'box': [217, 443, 286, 455]}, {'text': 'with', 'box': [291, 441, 318, 455]}, {'text': 'the', 'box': [327, 444, 347, 455]}, {'text': 'CTS300.', 'box': [352, 445, 399, 455]}, {'text': 'With', 'box': [413, 445, 445, 455]}, {'text': 'this', 'box': [449, 445, 478, 457]}, {'text': 'added,', 'box': [485, 446, 520, 455]}, {'text': 'measurement', 'box': [524, 448, 600, 459]}, {'text': 'R&D', 'box': [605, 448, 627, 459]}, {'text': 'will', 'box': [631, 445, 661, 459]}, {'text': 'be', 'box': [66, 454, 82, 464]}, {'text': 'able', 'box': [89, 455, 115, 465]}, {'text': 'to', 'box': [120, 455, 136, 465]}, {'text': 'replace', 'box': [143, 454, 192, 469]}, {'text': 'the', 'box': [197, 456, 217, 465]}, {'text': 'Firmness', 'box': [223, 455, 277, 467]}, {'text': 'Integrator', 'box': [282, 458, 353, 468]}, {'text': 'that', 'box': [359, 459, 386, 469]}, {'text': 'measures', 'box': [392, 460, 452, 469]}, {'text': 'cigarette', 'box': [455, 459, 519, 473]}, {'text': 'firmness', 'box': [525, 460, 581, 472]}, {'text': 'in', 'box': [584, 460, 599, 470]}, {'text': 'to', 'box': [66, 468, 81, 479]}, {'text': 'other', 'box': [87, 468, 122, 479]}, {'text': 'addition', 'box': [607, 463, 661, 474]}, {'text': 'measurements', 'box': [127, 470, 212, 480]}, {'text': 'that', 'box': [216, 470, 245, 481]}, {'text': 'are', 'box': [251, 471, 271, 481]}, {'text': 'mentioned', 'box': [277, 469, 341, 483]}, {'text': 'above.', 'box': [345, 470, 387, 482]}, {'text': 'The', 'box': [399, 473, 421, 485]}, {'text': 'Firmness', 'box': [428, 473, 483, 485]}, {'text': 'Integrator', 'box': [489, 473, 559, 485]}, {'text': 'is', 'box': [566, 473, 580, 485]}, {'text': 'no', 'box': [584, 476, 601, 485]}, {'text': 'longer', 'box': [605, 474, 649, 488]}, {'text': 'manufactured', 'box': [65, 483, 152, 494]}, {'text': 'and', 'box': [155, 481, 177, 493]}, {'text': 'parts', 'box': [183, 483, 218, 498]}, {'text': 'are', 'box': [222, 485, 244, 494]}, {'text': 'becoming', 'box': [249, 481, 305, 496]}, {'text': 'difficult', 'box': [309, 483, 374, 497]}, {'text': 'to', 'box': [379, 486, 395, 495]}, {'text': 'obtain.', 'box': [399, 488, 446, 499]}, {'text': 'Lastly,', 'box': [461, 488, 502, 498]}, {'text': '', 'box': [502, 493, 511, 500]}, {'text': 'of', 'box': [576, 489, 593, 501]}, {'text': 'this', 'box': [599, 488, 629, 499]}, {'text': 'instrument', 'box': [67, 496, 137, 507]}, {'text': 'would', 'box': [141, 496, 178, 507]}, {'text': 'purchase', 'box': [516, 488, 573, 502]}, {'text': 'provide', 'box': [182, 498, 229, 509]}, {'text': 'similar', 'box': [234, 498, 283, 509]}, {'text': 'capability', 'box': [292, 496, 359, 510]}, {'text': 'as', 'box': [364, 499, 381, 510]}, {'text': 'the', 'box': [385, 500, 409, 510]}, {'text': 'Macon', 'box': [411, 500, 448, 509]}, {'text': 'Plant', 'box': [454, 499, 491, 510]}, {'text': 'and', 'box': [496, 502, 520, 512]}, {'text': 'help', 'box': [521, 502, 553, 512]}, {'text': 'facilitate', 'box': [556, 500, 628, 514]}, {'text': 'comparisions', 'box': [69, 507, 150, 521]}, {'text': 'between', 'box': [153, 509, 204, 523]}, {'text': 'laboratories.', 'box': [209, 510, 298, 522]}], 'id': 77}, {'text': 'ESTIMATED SPENDING SCHEDULE', 'box': [268, 577, 455, 591], 'linking': [], 'label': 'header', 'words': [{'text': 'ESTIMATED', 'box': [268, 577, 332, 589]}, {'text': 'SPENDING', 'box': [337, 579, 393, 591]}, {'text': 'SCHEDULE', 'box': [398, 579, 455, 589]}], 'id': 78}, {'text': 'Balance to Spend', 'box': [403, 602, 515, 617], 'linking': [[79, 34], [79, 35]], 'label': 'header', 'words': [{'text': 'Balance', 'box': [403, 603, 455, 613]}, {'text': 'to', 'box': [460, 603, 476, 614]}, {'text': 'Spend', 'box': [483, 602, 515, 617]}], 'id': 79}, {'text': 'Spent Prior to', 'box': [44, 600, 141, 611], 'linking': [[80, 38]], 'label': 'question', 'words': [{'text': 'Spent', 'box': [44, 600, 79, 611]}, {'text': 'Prior', 'box': [86, 600, 121, 611]}, {'text': 'to', 'box': [126, 601, 141, 610]}], 'id': 80}, {'text': '1989 SPENDING BY QUARTER', 'box': [193, 668, 359, 684], 'linking': [], 'label': 'other', 'words': [{'text': '1989', 'box': [193, 668, 222, 682]}, {'text': 'SPENDING', 'box': [228, 670, 284, 682]}, {'text': 'BY', 'box': [287, 672, 303, 682]}, {'text': 'QUARTER', 'box': [308, 670, 359, 684]}], 'id': 81}, {'text': 'Approved by', 'box': [394, 844, 475, 859], 'linking': [], 'label': 'question', 'words': [{'text': 'Approved', 'box': [394, 845, 451, 857]}, {'text': 'by', 'box': [458, 844, 475, 859]}], 'id': 82}, {'text': 'Submitted by', 'box': [42, 840, 125, 854], 'linking': [[83, 84]], 'label': 'question', 'words': [{'text': 'Submitted', 'box': [42, 840, 104, 852]}, {'text': 'by', 'box': [110, 842, 125, 854]}], 'id': 83}, {'text': 'W. O. Crain', 'box': [61, 858, 140, 872], 'linking': [[83, 84]], 'label': 'answer', 'words': [{'text': 'W.', 'box': [61, 858, 77, 870]}, {'text': 'O.', 'box': [82, 860, 96, 870]}, {'text': 'Crain', 'box': [105, 860, 140, 872]}], 'id': 84}, {'text': 'Beyond 1993', 'box': [485, 808, 527, 830], 'linking': [[52, 85]], 'label': 'answer', 'words': [{'text': 'Beyond', 'box': [485, 808, 527, 819]}, {'text': '1993', 'box': [493, 819, 523, 830]}], 'id': 85}]}\n" ] } ], "source": [ "import logging\n", "from pathlib import Path\n", "\n", "from fintorch.datasets.invoice import InvoiceDataset\n", "\n", "logging.basicConfig(level=logging.INFO)\n", "\n", "data_path = Path(\"~/.fintorch_data/invoice-data/\").expanduser()\n", "auction_data = InvoiceDataset(data_path, force_reload=False)\n", "\n", "print(f\"Length of the dataset:{len(auction_data)} \\n Print first 10 records:\")\n", "\n", "for i in range(2):\n", " print(auction_data[i])\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Conclusion\n", "In this tutorial, we explored how to access and interpret the FUNSD dataset, reviewing its structure, annotations, and how it can be loaded using FinTorch utilities. With this foundation, you can seamlessly integrate the data into a PyTorch pipeline—allowing for batching, preprocessing, and model training. The annotation details (bounding boxes, text, and linking) illustrate the richness of this dataset for machine learning tasks involving document understanding, making it a prime resource for smart document analysis in finance and beyond.\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## References\n", "- [1] Jaume, G., Ekenel, H. K., & Thiran, J.-P. (2019). FUNSD: A dataset for form understanding in noisy scanned documents. In Proceedings of the International Conference on Document Analysis and Recognition - Open Service Track (ICDAR-OST). \n", "- [2] https://arxiv.org/pdf/1905.13538" ] }, { "cell_type": "markdown", "metadata": {}, "source": [] } ], "metadata": { "language_info": { "name": "python" } }, "nbformat": 4, "nbformat_minor": 2 }