Theo Viel commited on
Commit
a38bc63
·
1 Parent(s): 33c2c81

model card

Browse files
Files changed (1) hide show
  1. README.md +297 -0
README.md ADDED
@@ -0,0 +1,297 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: other
3
+ license_name: nvidia-open-model-license
4
+ license_link: >-
5
+ https://www.nvidia.com/en-us/agreements/enterprise-software/nvidia-open-model-license/
6
+ language:
7
+ - en
8
+ pipeline_tag: object-detection
9
+ arxiv: None
10
+ tags:
11
+ - image
12
+ - detection
13
+ - pdf
14
+ - ingestion
15
+ - yolox
16
+ ---
17
+ # Nemoretriever Graphic Element v1
18
+
19
+ ## **Model Overview**
20
+
21
+ ![viz.png](viz.png)
22
+ *Preview of the model output on the example image.*
23
+
24
+ The input of this model is expected to be a table image. You can use the [Nemoretriever Page Element v3](https://huggingface.co/nvidia/nemoretriever-page-elements-v3) to detect and crop such images.
25
+
26
+ ### Description
27
+
28
+ The **NeMo Retriever Table Structure v1** model is a specialized object detection model designed to identify and extract the structure of tables in images. Based on YOLOX, an anchor-free version of YOLO (You Only Look Once), this model combines a simpler architecture with enhanced performance. While the underlying technology builds upon work from [Megvii Technology](https://github.com/Megvii-BaseDetection/YOLOX), we developed our own base model through complete retraining rather than using pre-trained weights.
29
+
30
+ The model excels at detecting and localizing the fundamental structural elements within tables. Through careful fine-tuning, it can accurately identify and delineate three key components within tables:
31
+
32
+ 1. Individual cells (including merged cells)
33
+ 2. Rows
34
+ 3. Columns
35
+
36
+ This specialized focus on table structure enables precise decomposition of complex tables into their constituent parts, forming the foundation for downstream retrieval tasks. This model helps convert tables into the markdown format which can improve retrieval accuracy.
37
+
38
+ This model is ready for commercial use and is a part of the NVIDIA NeMo Retriever family of NIM microservices specifically for object detection and multimodal extraction of enterprise documents.
39
+
40
+ ### License/Terms of use
41
+
42
+ The use of this model is governed by the [NVIDIA Open Model License Agreement](https://www.nvidia.com/en-us/agreements/enterprise-software/nvidia-open-model-license/).
43
+
44
+ **You are responsible for ensuring that your use of NVIDIA provided models complies with all applicable laws.**
45
+
46
+
47
+ ### Team
48
+
49
+ - Theo Viel
50
+ - Bo Liu
51
+ - Darragh Hanley
52
+ - Even Oldridge
53
+
54
+ Correspondence to Theo Viel (tviel@nvidia.com) and Bo Liu (boli@nvidia.com)
55
+
56
+ ### Deployment Geography
57
+
58
+ Global
59
+
60
+ ### Use Case
61
+
62
+ The **NeMo Retriever Table Structure v1** model specializes in analyzing images containing tables by:
63
+ - Detecting and extracting table structure elements (rows, columns, and cells)
64
+ - Providing precise location information for each detected element
65
+ - Supporting downstream tasks like table analysis and data extraction
66
+
67
+ The model is designed to work in conjunction with OCR (Optical Character Recognition) systems to:
68
+ 1. Identify the structural layout of tables
69
+ 2. Preserve the relationships between table elements
70
+ 3. Enable accurate extraction of tabular data from images
71
+
72
+ Ideal for:
73
+ - Document processing systems
74
+ - Automated data extraction pipelines
75
+ - Digital content management solutions
76
+ - Business intelligence applications
77
+
78
+ ### Release Date
79
+
80
+ 10/23/2025 via https://huggingface.co/nvidia/nemoretriever-table-structure-v1
81
+
82
+ ### References
83
+
84
+ - YOLOX paper: https://arxiv.org/abs/2107.08430
85
+ - YOLOX repo: https://github.com/Megvii-BaseDetection/YOLOX
86
+ - Technical blog: https://developer.nvidia.com/blog/approaches-to-pdf-data-extraction-for-information-retrieval/
87
+
88
+ ### Model Architecture
89
+
90
+ **Architecture Type**: YOLOX <br>
91
+ **Network Architecture**: DarkNet53 Backbone \+ FPN Decoupled head (one 1x1 convolution \+ 2 parallel 3x3 convolutions (one for the classification and one for the bounding box prediction). YOLOX is a single-stage object detector that improves on Yolo-v3. <br>
92
+ **This model was developed based on the Yolo architecture** <br>
93
+ **Number of model parameters**: $5.4*10^7$ <br>
94
+
95
+ ### Input
96
+
97
+ **Input Type(s)**: Image <br>
98
+ **Input Format(s)**: Red, Green, Blue (RGB) <br>
99
+ **Input Parameters**: Two-Dimensional (2D)<br>
100
+ **Other Properties Related to Input**: Image size resized to `(1024, 1024)`
101
+
102
+ ### Output
103
+
104
+ **Output Type(s)**: Array <br>
105
+ **Output Format**: A dictionary of dictionaries containing `np.ndarray` objects. The outer dictionary has entries for each sample (page), and the inner dictionary contains a list of dictionaries, each with a bounding box (`np.ndarray`), class label, and confidence score for that page. <br>
106
+ **Output Parameters**: One-Dimensional (1D) <br>
107
+ **Other Properties Related to Output**: The output contains bounding boxes, detection confidence scores, and object classes (cell, row, column). The thresholds used for non-maximum suppression are `conf_thresh = 0.01` and `iou_thresh = 0.25`
108
+ **Output Classes**: <br>
109
+ * Cell
110
+ * Table cell
111
+ * Row
112
+ * Table row
113
+ * Column
114
+ * Table column
115
+
116
+ Our AI models are designed and/or optimized to run on NVIDIA GPU-accelerated systems. By leveraging NVIDIA’s hardware (e.g. GPU cores) and software frameworks (e.g., CUDA libraries), the model achieves faster training and inference times compared to CPU-only solutions.
117
+
118
+
119
+ ### Usage
120
+
121
+ The model requires torch, and the custom code available in this repository.
122
+
123
+ 1. Clone the repository
124
+
125
+ - Make sure git-lfs is installed (https://git-lfs.com)
126
+ ```
127
+ git lfs install
128
+ ```
129
+ - Using https
130
+ ```
131
+ git clone https://huggingface.co/nvidia/nemoretriever-table-structure-v1
132
+ ```
133
+ - Or using ssh
134
+ ```
135
+ git clone git@hf.co:nvidia/nemoretriever-table-structure-v1
136
+ ```
137
+
138
+ 2. Run the model using the following code:
139
+
140
+ ```
141
+ import torch
142
+ import numpy as np
143
+ import matplotlib.pyplot as plt
144
+ from PIL import Image
145
+
146
+ from model import define_model
147
+ from utils import plot_sample, postprocess_preds_graphic_element, reformat_for_plotting
148
+
149
+ # Load image
150
+ path = "./example.png"
151
+ img = Image.open(path).convert("RGB")
152
+ img = np.array(img)
153
+
154
+ # Load model
155
+ model = define_model("table_structure_v1")
156
+
157
+ # Inference
158
+ with torch.inference_mode():
159
+ x = model.preprocess(img)
160
+ preds = model(x, img.shape)[0]
161
+
162
+ print(preds)
163
+
164
+ # Post-processing
165
+ boxes, labels, scores = postprocess_preds_table_structure(preds, model.threshold, model.labels)
166
+
167
+ # Plot
168
+ boxes_plot, confs = reformat_for_plotting(boxes, labels, scores, img.shape, model.num_classes)
169
+
170
+ plt.figure(figsize=(15, 10))
171
+ plot_sample(img, boxes_plot, confs, labels=model.labels)
172
+ plt.show()
173
+ ```
174
+
175
+ Note that this repository only provides minimal code to infer the model.
176
+ If you wish to do additional training, [refer to the original repo](https://github.com/Megvii-BaseDetection/YOLOX).
177
+
178
+ 3. Advanced post-processing
179
+
180
+ Additional post-processing might be required to use the model as part of a data extraction pipeline.
181
+ We provide examples in the notebook `Demo.ipynb`.
182
+
183
+ <!---
184
+ ### Software Integration
185
+
186
+ **Runtime Engine(s):**
187
+ - **NeMo Retriever Page Elements v3** NIM
188
+
189
+
190
+ **Supported Hardware Microarchitecture Compatibility [List in Alphabetic Order]:**
191
+ - NVIDIA Ampere
192
+ - NVIDIA Hopper
193
+ - NVIDIA Lovelace
194
+
195
+ **Preferred/Supported Operating System(s):**
196
+ - Linux
197
+
198
+ The integration of foundation and fine-tuned models into AI systems requires additional testing using use-case-specific data to ensure safe and effective deployment. Following the V-model methodology, iterative testing and validation at both unit and system levels are essential to mitigate risks, meet technical and functional requirements, and ensure compliance with safety and ethical standards before deployment.
199
+ This AI model can be embedded as an Application Programming Interface (API) call into the software environment described above.
200
+ --->
201
+
202
+ ## Model Version(s):
203
+
204
+ * `nemoretriever-table-structure-v1`
205
+
206
+ ## Training and Evaluation Datasets:
207
+
208
+ ### Training Dataset
209
+
210
+ **Data Modality**: Image <br>
211
+ **Image Training Data Size**: Less than a Million Images <br>
212
+ **Data collection method by dataset**: Automated <br>
213
+ **Labeling method by dataset**: Automated <br>
214
+ **Pretraining (by NVIDIA)**: 118,287 images of the [COCO train2017](https://cocodataset.org/#download) dataset <br>
215
+ **Finetuning (by NVIDIA)**: 23,977 images from [Digital Corpora dataset](https://digitalcorpora.org/), with annotations from [Azure AI Document Intelligence](https://azure.microsoft.com/en-us/products/ai-services/ai-document-intelligence). <br>
216
+ **Number of bounding boxes per class:** 1,828,978 cells, 134,089 columns and 316,901 rows. The layout model of Document Intelligence was used with `2024-02-29-preview` API version.
217
+
218
+ ### Evaluation Results
219
+
220
+ The primary evaluation set is a cut of the Azure labels and digital corpora images. Number of bounding boxes per class: 200,840 cells, 13,670 columns and 34,575 rows. Mean Average Precision (mAP) was used as an evaluation metric, which measures the model's ability to correctly identify and localize objects across different confidence thresholds.
221
+
222
+ **Data collection method by dataset**: Hybrid: Automated, Human <br>
223
+ **Labeling method by dataset**: Hybrid: Automated, Human <br>
224
+ **Properties**: We evaluated with Azure labels from manually selected pages, as well as manual inspection on public PDFs and powerpoint slides.
225
+
226
+ **Per-class Performance Metrics**:
227
+ | Class | AP (%) | AR (%) |
228
+ |:-------|:-------|:-------|
229
+ | cell | 58.365 | 60.647 |
230
+ | row | 76.992 | 81.115 |
231
+ | column | 85.293 | 87.434 |
232
+
233
+ ## Inference:
234
+
235
+ **Acceleartion Engine**: TensorRT <br>
236
+ **Test hardware**: See [Support Matrix from NIM documentation](https://docs.nvidia.com/nim/ingestion/object-detection/latest/support-matrix.html#)
237
+
238
+ <!---
239
+ ## Inference:
240
+
241
+ **Acceleartion Engine**: TensorRT <br>
242
+ **Test hardware**: See [Support Matrix from NIM documentation](https://docs.nvidia.com/nim/ingestion/object-detection/latest/support-matrix.html#)
243
+ --->
244
+
245
+ ## Ethical Considerations
246
+
247
+ NVIDIA believes Trustworthy AI is a shared responsibility and we have established policies and practices to enable development for a wide array of AI applications. When downloaded or used in accordance with our terms of service, developers should work with their internal model team to ensure this model meets requirements for the relevant industry and use case and addresses unforeseen product misuse.
248
+
249
+ **For more detailed information on ethical considerations for this model**, please see the Model Card++ [Explainability](explainability.md), [Bias](bias.md), [Safety & Security](safety-security.md), and [Privacy](privacy.md) Subcards.
250
+
251
+ Please report security vulnerabilities or NVIDIA AI Concerns [here](https://www.nvidia.com/en-us/support/submit-security-vulnerability/).
252
+
253
+ ## Bias
254
+
255
+ | Field | Response |
256
+ | ----- | ----- |
257
+ | Participation considerations from adversely impacted groups [protected classes](https://www.senate.ca.gov/content/protected-classes) in model design and testing | None |
258
+ | Measures taken to mitigate against unwanted bias | None |
259
+
260
+ ## Explainability
261
+
262
+ | Field | Response |
263
+ | ----- | ----- |
264
+ | Intended Application & Domain: | Object Detection |
265
+ | Model Type: | YOLOX-architecture for detection of table structure within images of tables. |
266
+ | Intended User: | Enterprise developers, data scientists, and other technical users who need to extract table structure from images. |
267
+ | Output: | After post-processing, the output is three numpy array that contains the detections: `boxes [N x 4]` (format is normalized `(x_min, y_min, x_max, y_max)`), associated classes: `labels [N]` and confidence scores: `scores [N]`.|
268
+ | Describe how the model works: | Finds and identifies objects in images by first dividing the image into a grid. For each section of the grid, the model uses a series of neural networks to extract visual features and simultaneously predict what objects are present (in this case "cell", "row", or "column") and exactly where they are located in that section, all in a single pass through the image. |
269
+ | Name the adversely impacted groups this has been tested to deliver comparable outcomes regardless of: | Not Applicable |
270
+ | Technical Limitations & Mitigation: | The model may not generalize to unknown table formats. Further fine-tuning might be required for such documents. Furthermore, it is not robust to rotated tables. |
271
+ | Verified to have met prescribed NVIDIA quality standards: | Yes |
272
+ | Performance Metrics: | Mean Average Precision, detectionr recall and visual inspection |
273
+ | Potential Known Risks: | This model may not always detect all elements in a document. |
274
+ | Licensing & Terms of Use: | Use of this model is governed by the [NVIDIA AI Foundation Models Community License Agreement](https://www.nvidia.com/en-us/agreements/enterprise-software/nvidia-ai-foundation-models-community-license-agreement/) and the [Apache 2.0 License](https://github.com/Megvii-BaseDetection/YOLOX/blob/main/LICENSE). |
275
+
276
+
277
+ ## Privacy
278
+
279
+ | Field | Response |
280
+ | ----- | ----- |
281
+ | Generatable or reverse engineerable personal data? | No |
282
+ | Personal data used to create this model? | No |
283
+ | Was consent obtained for any personal data used? | Not Applicable |
284
+ | How often is the dataset reviewed? | Before Release |
285
+ | Is there provenance for all datasets used in training? | Yes |
286
+ | Does data labeling (annotation, metadata) comply with privacy laws? | Yes |
287
+ | Is data compliant with data subject requests for data correction or removal, if such a request was made? | No, not possible with externally-sourced data. |
288
+ | Applicable Privacy Policy | https://www.nvidia.com/en-us/about-nvidia/privacy-policy/ |
289
+
290
+ ## Safety
291
+
292
+ | Field | Response |
293
+ | ----- | ----- |
294
+ | Model Application Field(s): | Object Detection for Retrieval, focused on Enterprise |
295
+ | Describe the life critical impact (if present). | Not Applicable |
296
+ | Use Case Restrictions: | Abide by [NVIDIA Open Model License Agreement](https://www.nvidia.com/en-us/agreements/enterprise-software/nvidia-open-model-license/). |
297
+ | Model and dataset restrictions: | The Principle of least privilege (PoLP) is applied limiting access for dataset generation and model development. Restrictions enforce dataset access during training, and dataset license constraints adhered to. |