---
title: "cached"
publisher: "university-at-buffalo"
type: "endpoint"
updated: "2025-01-14T01:43:32.447Z"
description: "Context-aware chart extraction that can detect 18 classes for chart basic elements, excluding plot elements."
canonical: "https://build.nvidia.com/university-at-buffalo/cached"
---

## Model Overview

### Description

CACHED (Context-Aware Chart Element Detection) is a state-of-the-art chart element detection model from University at Buffalo. It was published in Document Analysis and Recognition - ICDAR 2023 conference. The code is based on the MMDetection Framework.

CACHED is associated with PaddleOCR to perform Optical Character Recognition (OCR). PaddleOCR is an ultra lightweight OCR system by Baidu.

This model is ready for commercial use.

## Third-Party Community Consideration

This model is not owned or developed by NVIDIA. This model has been developed and built to a third-party’s requirements for this application and use case; see links to Non-NVIDIA [Context-Aware Chart Element Detection GitHub](https://github.com/pengyu965/ChartDete) and [PaddleOCR Toolkit](https://github.com/PaddlePaddle/PaddleOCR).

### Terms of use
CACHED is licensed under  [MIT](https://opensource.org/license/mit).
PaddleOCR is licensed under  [Apache-2](https://www.apache.org/licenses/LICENSE-2.0).

**You are responsible for ensuring that your use of models complies with all applicable laws.**

### References
- CACHED
- [Github](https://github.com/pengyu965/ChartDete)
- [Arxiv](https://arxiv.org/abs/2305.04151)
- PaddleOCR
- [Github](https://github.com/PaddlePaddle/PaddleOCR/blob/main/README_en.md)
- [Arxiv](https://arxiv.org/abs/2206.03001)

## Model Architecture

- CACHED
- **Architecture Type:** Region-Based Convolutional Neural Network (R-CNN)
- **Network Architecture:** Cascade with local-global context fusion module
- PaddleOCR
- **Architecture Type for Text Detector:** CNN
-  **Network Architecture for Text Detector:**  LK-PAN
- **Architecture Type for Text Recognition:** Hybrid Transformer CNN
- **Network Architecture for Text Recognition:** SVTR-LCNet (NRTR Head and CTCLoss head)

## Input

**Input Type(s):** Image <br>
**Input Format(s):** Red, Green, Blue (RGB) <br>
**Input Parameters:** Two Dimensional (2D) <br>
**Other Properties Related to Input:** Expected input is a nd array image of shape `[Channel, Width, Height]`, or a nd array batch of image of shape `[Batch, Channel, Width, Height]`. <br>

## Output
**Output Type(s):** Text associated to each of the following classes : `"chart_title", "x_title", "y_title", "xlabel", "ylabel", "other", "legend_label", "legend_title", "mark_label", "value_label"` <br>
**Output Format:** Dict of String <br>
**Output Parameters:** 1D <br>
**Other Properties Related to Output:** None <br>

**Supported Hardware Microarchitecture Compatibility:** NVIDIA Ampere, NVIDIA Hopper, NVIDIA Lovelace<br>

## Supported Operating System(s):
* Linux <br>

## Model Version(s):
* university-at-buffalo/cached <br>

## Training Dataset:

None of the models were trained by NVIDIA.

- PubMed Central (PMC) Chart Dataset
- **Link:** https://chartinfo.github.io/index_2022.html. No nSpect ID.
- **Data Collection Method:** Automated, Human
- **Labeling Method**: Human
- **Description:** A real-world dataset collected from PubMed Central Documents and manually annotated, released in the ICPR 2022 CHART-Infographic competition. There are 5614 images for chart element detection, 4293 images for final plot detection and data extraction, and 22924 images for chart classification.

- Text detection and recognition datasets
- **Link:** Refer to https://github.com/PaddlePaddle/PaddleOCR. No nSpect ID.
- **Data Collection Method:** Human, Synthetic, Unknown
- **Labeling Method**: Human, Synthetic, Unknown
- **Description:** PaddleOCR is trained on a collection of OCR datasets which includes: LSVT (Sun et al. 2019), RCTW-17 (Shiet al. 2017), MTWI 2018 (He and Yang 2018), CASIA-10K (He et al. 2018), SROIE (Huang et al. 2019), MLT 2019 (Nayef et al. 2019), BDI (Karatzas et al. 2011), MSRATD500 (Yao et al. 2012) and CCPD 2019 (Xu et al. 2018).

## Inference:
**Engine:** Tensor(RT) <br>
**Test Hardware:** Tested on all supported hardware listed in compatibility section <br>

## Ethical Considerations:
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.

Please report security vulnerabilities or NVIDIA AI Concerns [here](https://www.nvidia.com/en-us/support/submit-security-vulnerability/).

## Prototype

```python
import requests, base64

invoke_url = "https://ai.api.nvidia.com/v1/cv/university-at-buffalo/cached"

with open("cached1.png", "rb") as f:
image_b64 = base64.b64encode(f.read()).decode()

assert len(image_b64) < 180_000, \
"To upload larger images, use the assets API (see docs)"

headers = {
"Authorization": "Bearer $NVIDIA_API_KEY",
"Accept": "application/json"
}

payload = {
"messages": [
{
"content": [{
"type": "image_url",
"image_url": {
"url": f"data:image/png;base64,{image_b64}"
}
}]
}
]
}

response = requests.post(invoke_url, headers=headers, json=payload)

print(response.json())
```

```javascript
import axios from 'axios';
import { readFile } from 'node:fs/promises';

const invokeUrl = "https://ai.api.nvidia.com/v1/cv/university-at-buffalo/cached";

const headers = {
"Authorization": "Bearer $NVIDIA_API_KEY",
"Accept": "application/json"
};

readFile("cached1.png")
.then(data => {
const imageB64 = Buffer.from(data).toString('base64');
if (imageB64.length > 180_000) {
throw new Error("To upload larger images, use the assets API (see docs)");
}

const payload = {
"messages": [
{
"content": [{
"type": "image_url",
"image_url": {
"url": `data:image/png;base64,${imageB64}`
}
}]
}
]
};

return axios.post(invokeUrl, payload, { headers: headers, responseType: 'json' });
})
.then(response => {
console.log(JSON.stringify(response.data));
})
.catch(error => {
console.error(error);
});
```

```bash
image_b64=$( base64 -i cached1.png )

accept_header='Accept: application/json'

# Construct the JSON payload
echo '{
"messages": [
{
"content": [{
"type": "image_url",
"image_url": {
"url": "data:image/png;base64,'"${image_b64}"'"
}
}]
}
]
}' > payload.json

curl https://ai.api.nvidia.com/v1/cv/university-at-buffalo/cached \
-H "Authorization: Bearer $NVIDIA_API_KEY" \
-H "Content-Type: application/json" \
-H "$accept_header" \
-d @payload.json
```