Nikola commited on
Commit
f414e70
1 Parent(s): a192224

Added files

Browse files
README.md ADDED
@@ -0,0 +1,111 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ tags:
3
+ - generated_from_trainer
4
+ datasets:
5
+ - invoice
6
+ metrics:
7
+ - precision
8
+ - recall
9
+ - f1
10
+ - accuracy
11
+ model-index:
12
+ - name: layoutlmv3-finetuned-invoice
13
+ results:
14
+ - task:
15
+ name: Token Classification
16
+ type: token-classification
17
+ dataset:
18
+ name: Invoice
19
+ type: invoice
20
+ args: invoice
21
+ metrics:
22
+ - name: Precision
23
+ type: precision
24
+ value: 1.0
25
+ - name: Recall
26
+ type: recall
27
+ value: 1.0
28
+ - name: F1
29
+ type: f1
30
+ value: 1.0
31
+ - name: Accuracy
32
+ type: accuracy
33
+ value: 1.0
34
+ ---
35
+
36
+ # LayoutLM-v3 model fine-tuned on invoice dataset
37
+
38
+ This model is a fine-tuned version of [microsoft/layoutlmv3-base](https://huggingface.co/microsoft/layoutlmv3-base) on the invoice dataset.
39
+
40
+ We use Microsoft’s LayoutLMv3 trained on Invoice Dataset to predict the Biller Name, Biller Address, Biller post_code, Due_date, GST, Invoice_date, Invoice_number, Subtotal and Total. To use it, simply upload an image or use the example image below. Results will show up in a few seconds.
41
+
42
+ It achieves the following results on the evaluation set:
43
+ - Loss: 0.0012
44
+ - Precision: 1.0
45
+ - Recall: 1.0
46
+ - F1: 1.0
47
+ - Accuracy: 1.0
48
+
49
+ ## Model description
50
+
51
+ More information needed
52
+
53
+ ## Intended uses & limitations
54
+
55
+ More information needed
56
+
57
+ ## Training and evaluation data
58
+ All the training codes are available from the below GitHub link.
59
+
60
+ https://github.com/Theivaprakasham/layoutlmv3
61
+
62
+
63
+ The model can be evaluated at the HuggingFace Spaces link:
64
+
65
+ https://huggingface.co/spaces/Theivaprakasham/layoutlmv3_invoice
66
+
67
+ ## Training procedure
68
+
69
+ ### Training hyperparameters
70
+
71
+ The following hyperparameters were used during training:
72
+ - learning_rate: 1e-05
73
+ - train_batch_size: 2
74
+ - eval_batch_size: 2
75
+ - seed: 42
76
+ - optimizer: Adam with betas=(0.9,0.999) and epsilon=1e-08
77
+ - lr_scheduler_type: linear
78
+ - training_steps: 2000
79
+
80
+ ### Training results
81
+
82
+ | Training Loss | Epoch | Step | Validation Loss | Precision | Recall | F1 | Accuracy |
83
+ |:-------------:|:-----:|:----:|:---------------:|:---------:|:------:|:------:|:--------:|
84
+ | No log | 2.0 | 100 | 0.0878 | 0.968 | 0.9817 | 0.9748 | 0.9966 |
85
+ | No log | 4.0 | 200 | 0.0241 | 0.972 | 0.9858 | 0.9789 | 0.9971 |
86
+ | No log | 6.0 | 300 | 0.0186 | 0.972 | 0.9858 | 0.9789 | 0.9971 |
87
+ | No log | 8.0 | 400 | 0.0184 | 0.9854 | 0.9574 | 0.9712 | 0.9956 |
88
+ | 0.1308 | 10.0 | 500 | 0.0121 | 0.972 | 0.9858 | 0.9789 | 0.9971 |
89
+ | 0.1308 | 12.0 | 600 | 0.0076 | 0.9939 | 0.9878 | 0.9908 | 0.9987 |
90
+ | 0.1308 | 14.0 | 700 | 0.0047 | 1.0 | 0.9959 | 0.9980 | 0.9996 |
91
+ | 0.1308 | 16.0 | 800 | 0.0036 | 0.9960 | 0.9980 | 0.9970 | 0.9996 |
92
+ | 0.1308 | 18.0 | 900 | 0.0045 | 0.9960 | 0.9980 | 0.9970 | 0.9996 |
93
+ | 0.0069 | 20.0 | 1000 | 0.0043 | 0.9960 | 0.9980 | 0.9970 | 0.9996 |
94
+ | 0.0069 | 22.0 | 1100 | 0.0016 | 1.0 | 1.0 | 1.0 | 1.0 |
95
+ | 0.0069 | 24.0 | 1200 | 0.0015 | 1.0 | 1.0 | 1.0 | 1.0 |
96
+ | 0.0069 | 26.0 | 1300 | 0.0014 | 1.0 | 1.0 | 1.0 | 1.0 |
97
+ | 0.0069 | 28.0 | 1400 | 0.0013 | 1.0 | 1.0 | 1.0 | 1.0 |
98
+ | 0.0026 | 30.0 | 1500 | 0.0012 | 1.0 | 1.0 | 1.0 | 1.0 |
99
+ | 0.0026 | 32.0 | 1600 | 0.0012 | 1.0 | 1.0 | 1.0 | 1.0 |
100
+ | 0.0026 | 34.0 | 1700 | 0.0011 | 1.0 | 1.0 | 1.0 | 1.0 |
101
+ | 0.0026 | 36.0 | 1800 | 0.0011 | 1.0 | 1.0 | 1.0 | 1.0 |
102
+ | 0.0026 | 38.0 | 1900 | 0.0011 | 1.0 | 1.0 | 1.0 | 1.0 |
103
+ | 0.002 | 40.0 | 2000 | 0.0011 | 1.0 | 1.0 | 1.0 | 1.0 |
104
+
105
+
106
+ ### Framework versions
107
+
108
+ - Transformers 4.20.0.dev0
109
+ - Pytorch 1.11.0+cu113
110
+ - Datasets 2.2.2
111
+ - Tokenizers 0.12.1
config.json ADDED
@@ -0,0 +1,68 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "_name_or_path": "microsoft/layoutlmv3-base",
3
+ "architectures": [
4
+ "LayoutLMv3ForTokenClassification"
5
+ ],
6
+ "attention_probs_dropout_prob": 0.1,
7
+ "bos_token_id": 0,
8
+ "classifier_dropout": null,
9
+ "coordinate_size": 128,
10
+ "eos_token_id": 2,
11
+ "has_relative_attention_bias": true,
12
+ "has_spatial_attention_bias": true,
13
+ "hidden_act": "gelu",
14
+ "hidden_dropout_prob": 0.1,
15
+ "hidden_size": 768,
16
+ "id2label": {
17
+ "0": "O",
18
+ "1": "B-ABN",
19
+ "2": "B-BILLER",
20
+ "3": "B-BILLER_ADDRESS",
21
+ "4": "B-BILLER_POST_CODE",
22
+ "5": "B-DUE_DATE",
23
+ "6": "B-GST",
24
+ "7": "B-INVOICE_DATE",
25
+ "8": "B-INVOICE_NUMBER",
26
+ "9": "B-SUBTOTAL",
27
+ "10": "B-TOTAL",
28
+ "11": "I-BILLER_ADDRESS"
29
+ },
30
+ "initializer_range": 0.02,
31
+ "input_size": 224,
32
+ "intermediate_size": 3072,
33
+ "label2id": {
34
+ "B-ABN": 1,
35
+ "B-BILLER": 2,
36
+ "B-BILLER_ADDRESS": 3,
37
+ "B-BILLER_POST_CODE": 4,
38
+ "B-DUE_DATE": 5,
39
+ "B-GST": 6,
40
+ "B-INVOICE_DATE": 7,
41
+ "B-INVOICE_NUMBER": 8,
42
+ "B-SUBTOTAL": 9,
43
+ "B-TOTAL": 10,
44
+ "I-BILLER_ADDRESS": 11,
45
+ "O": 0
46
+ },
47
+ "layer_norm_eps": 1e-05,
48
+ "max_2d_position_embeddings": 1024,
49
+ "max_position_embeddings": 514,
50
+ "max_rel_2d_pos": 256,
51
+ "max_rel_pos": 128,
52
+ "model_type": "layoutlmv3",
53
+ "num_attention_heads": 12,
54
+ "num_channels": 3,
55
+ "num_hidden_layers": 12,
56
+ "pad_token_id": 1,
57
+ "patch_size": 16,
58
+ "rel_2d_pos_bins": 64,
59
+ "rel_pos_bins": 32,
60
+ "second_input_size": 112,
61
+ "shape_size": 128,
62
+ "text_embed": true,
63
+ "torch_dtype": "float32",
64
+ "transformers_version": "4.20.0.dev0",
65
+ "type_vocab_size": 1,
66
+ "visual_embed": true,
67
+ "vocab_size": 50265
68
+ }
merges.txt ADDED
The diff for this file is too large to render. See raw diff
 
preprocessor_config.json ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "apply_ocr": false,
3
+ "do_normalize": true,
4
+ "do_resize": true,
5
+ "feature_extractor_type": "LayoutLMv3FeatureExtractor",
6
+ "image_mean": [
7
+ 0.5,
8
+ 0.5,
9
+ 0.5
10
+ ],
11
+ "image_std": [
12
+ 0.5,
13
+ 0.5,
14
+ 0.5
15
+ ],
16
+ "ocr_lang": null,
17
+ "processor_class": "LayoutLMv3Processor",
18
+ "resample": 2,
19
+ "size": 224
20
+ }
pytorch_model.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:1e56c5b00810cea3312c57323a2a8fa4f58303c5119927a8965e519865b9740a
3
+ size 503784271
runs/Jun07_04-11-18_850ddd2feefa/1654575104.0822/events.out.tfevents.1654575104.850ddd2feefa.781.1 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:59dd0c0edade55c183467c8dc6da19c9a54a9aab2715fe4f255efb8a24ae50f7
3
+ size 5301
runs/Jun07_04-11-18_850ddd2feefa/events.out.tfevents.1654575104.850ddd2feefa.781.0 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:fd82fc110706e64c7ebe31e70e5a7c7595d0b158b1642350de79e59ae9baa9b6
3
+ size 14962
runs/Jun07_04-11-18_850ddd2feefa/events.out.tfevents.1654575554.850ddd2feefa.781.2 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b52105a72cd1cf945a11bc859ad607b1c6b21110806875b5329832d9e1f0c1df
3
+ size 512
special_tokens_map.json ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "bos_token": {
3
+ "content": "<s>",
4
+ "lstrip": false,
5
+ "normalized": true,
6
+ "rstrip": false,
7
+ "single_word": false
8
+ },
9
+ "cls_token": {
10
+ "content": "<s>",
11
+ "lstrip": false,
12
+ "normalized": true,
13
+ "rstrip": false,
14
+ "single_word": false
15
+ },
16
+ "eos_token": {
17
+ "content": "</s>",
18
+ "lstrip": false,
19
+ "normalized": true,
20
+ "rstrip": false,
21
+ "single_word": false
22
+ },
23
+ "mask_token": {
24
+ "content": "<mask>",
25
+ "lstrip": true,
26
+ "normalized": true,
27
+ "rstrip": false,
28
+ "single_word": false
29
+ },
30
+ "pad_token": {
31
+ "content": "<pad>",
32
+ "lstrip": false,
33
+ "normalized": true,
34
+ "rstrip": false,
35
+ "single_word": false
36
+ },
37
+ "sep_token": {
38
+ "content": "</s>",
39
+ "lstrip": false,
40
+ "normalized": true,
41
+ "rstrip": false,
42
+ "single_word": false
43
+ },
44
+ "unk_token": {
45
+ "content": "<unk>",
46
+ "lstrip": false,
47
+ "normalized": true,
48
+ "rstrip": false,
49
+ "single_word": false
50
+ }
51
+ }
tokenizer.json ADDED
The diff for this file is too large to render. See raw diff
 
tokenizer_config.json ADDED
@@ -0,0 +1,87 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "add_prefix_space": true,
3
+ "apply_ocr": false,
4
+ "bos_token": {
5
+ "__type": "AddedToken",
6
+ "content": "<s>",
7
+ "lstrip": false,
8
+ "normalized": true,
9
+ "rstrip": false,
10
+ "single_word": false
11
+ },
12
+ "cls_token": {
13
+ "__type": "AddedToken",
14
+ "content": "<s>",
15
+ "lstrip": false,
16
+ "normalized": true,
17
+ "rstrip": false,
18
+ "single_word": false
19
+ },
20
+ "cls_token_box": [
21
+ 0,
22
+ 0,
23
+ 0,
24
+ 0
25
+ ],
26
+ "eos_token": {
27
+ "__type": "AddedToken",
28
+ "content": "</s>",
29
+ "lstrip": false,
30
+ "normalized": true,
31
+ "rstrip": false,
32
+ "single_word": false
33
+ },
34
+ "errors": "replace",
35
+ "mask_token": {
36
+ "__type": "AddedToken",
37
+ "content": "<mask>",
38
+ "lstrip": true,
39
+ "normalized": true,
40
+ "rstrip": false,
41
+ "single_word": false
42
+ },
43
+ "model_max_length": 512,
44
+ "name_or_path": "microsoft/layoutlmv3-base",
45
+ "only_label_first_subword": true,
46
+ "pad_token": {
47
+ "__type": "AddedToken",
48
+ "content": "<pad>",
49
+ "lstrip": false,
50
+ "normalized": true,
51
+ "rstrip": false,
52
+ "single_word": false
53
+ },
54
+ "pad_token_box": [
55
+ 0,
56
+ 0,
57
+ 0,
58
+ 0
59
+ ],
60
+ "pad_token_label": -100,
61
+ "processor_class": "LayoutLMv3Processor",
62
+ "sep_token": {
63
+ "__type": "AddedToken",
64
+ "content": "</s>",
65
+ "lstrip": false,
66
+ "normalized": true,
67
+ "rstrip": false,
68
+ "single_word": false
69
+ },
70
+ "sep_token_box": [
71
+ 0,
72
+ 0,
73
+ 0,
74
+ 0
75
+ ],
76
+ "special_tokens_map_file": null,
77
+ "tokenizer_class": "LayoutLMv3Tokenizer",
78
+ "trim_offsets": true,
79
+ "unk_token": {
80
+ "__type": "AddedToken",
81
+ "content": "<unk>",
82
+ "lstrip": false,
83
+ "normalized": true,
84
+ "rstrip": false,
85
+ "single_word": false
86
+ }
87
+ }
training_args.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:2b31a8aa3c53635eb720f2120c38fe5ba45e70202217215d54430b42c6cba20a
3
+ size 3311
vocab.json ADDED
The diff for this file is too large to render. See raw diff