File size: 6,081 Bytes
2eb05fd
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
---
license: apache-2.0
language:
- en
base_model:
- microsoft/resnet-50
pipeline_tag: image-classification
---

# Model Card for ChartTypeNet-DocFigure

ChartTypeNet-DocFigure is a deep learning model for scientific chart type classification. Given a single chart image, it predicts the chart type among 28 scientific figure categories. The model is trained on the DocFigure dataset, the largest and most diverse public dataset for document figure classification.

## Model Details

### Model Description

ChartTypeNet-DocFigure automates the classification of scientific chart types in document images. It leverages a ResNet-50 backbone and is trained on 33,000 annotated figures from the DocFigure dataset, covering 28 distinct chart types. This model is intended for use in document image understanding, chart parsing, dataset analysis, and scientific document mining.

- **Developed by:** Hansheng Zhu
- **Model type:** Image Classification
- **License:** Apache-2.0
- **Finetuned from model:** microsoft/resnet-50

### Model Sources

- **Repository:** [https://github.com/hanszhu/ChartSense](https://github.com/hanszhu/ChartSense)
- **Paper:** https://arxiv.org/abs/2106.01841

## Uses

### Direct Use

- Scientific chart type classification from images
- Preprocessing for document image understanding pipelines
- Dataset analysis and mining in scientific literature

### Downstream Use

- As a preprocessing step for chart element detection or information extraction
- Integration into document parsing or digital library systems

### Out-of-Scope Use

- Classification of non-scientific images
- Use on charts outside the 28 DocFigure categories
- Medical or legal decision making

## Bias, Risks, and Limitations

- The model is limited to the 28 chart types present in the DocFigure dataset.
- May not generalize to charts with highly unusual styles or poor image quality.
- Potential dataset bias: DocFigure is sourced from computer vision conference papers.

### Recommendations

Users should verify predictions on out-of-domain data and be aware of the model’s limitations regarding chart style and domain.

## How to Get Started with the Model

```python
import torch
from PIL import Image
from torchvision import transforms

# Load model (example, adjust for your codebase)
model = torch.load('chart_type.pth', map_location='cpu')
model.eval()

# Preprocess image
img = Image.open('example_chart.png').convert('RGB')
transform = transforms.Compose([
    transforms.Resize((224, 224)),  # or as used in your training
    transforms.ToTensor(),
    transforms.Normalize(mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225])
])
input_tensor = transform(img).unsqueeze(0)

# Inference
with torch.no_grad():
    logits = model(input_tensor)
    pred = logits.argmax(dim=1).item()

# Map to label
chart_type_labels = [
    'Line graph', 'Natural image', 'Table', '3D object', 'Bar plot', 'Scatter plot',
    'Medical image', 'Sketch', 'Geographic map', 'Flow chart', 'Heat map', 'Mask',
    'Block diagram', 'Venn diagram', 'Confusion matrix', 'Histogram', 'Box plot',
    'Vector plot', 'Pie chart', 'Surface plot', 'Algorithm', 'Contour plot',
    'Tree diagram', 'Bubble chart', 'Polar plot', 'Area chart', 'Pareto chart', 'Radar chart'
]
print("Predicted chart type:", chart_type_labels[pred])
```

## Training Details

### Training Data

- **Dataset:** [DocFigure](https://arxiv.org/abs/2106.01841)
- 33,000 annotated figures from scientific articles (CVPR, ECCV, ICCV, etc.)
- 28 chart types, manually labeled using a custom web-based tool

### Training Procedure

- Images resized to 224x224
- Normalized using ImageNet statistics
- **Training regime:** fp32
- **Optimizer:** Adam
- **Batch size:** 64
- **Epochs:** 30
- **Learning rate:** 1e-4

## Evaluation

### Testing Data, Factors & Metrics

- **Testing Data:** Held-out split from DocFigure dataset
- **Factors:** Chart type, image quality
- **Metrics:** Accuracy, Similarity-aware Accuracy (SimAcc), Confusion Analysis, F1 score, Precision, Recall

### Results

| Metric           | Train   | Validation |
|------------------|---------|------------|
| Accuracy         | 95.61%  | 86.71%     |
| SimAcc           | 98.70%  | 96.20%     |
| Best Val Acc     |         | 87.03%     |
| Total Loss       | 1.3843  | 2.2681     |
| Base Loss        | 0.887   | 1.073      |
| Sim Loss         | 0.372   | 1.192      |
| Cont Loss        | 0.125   | 0.004      |
| Learning Rate    | 0.000000| 0.000000   |

#### Confusion Analysis
- High-penalty confusion: 16.57%
- S↔B: 8 | L↔A: 30 | B↔H: 93

#### Summary

Enhanced training completed! The model achieves a best validation accuracy of **87.03%** and a final similarity-aware accuracy (SimAcc) of **96.20%**. Training accuracy is **95.61%** (SimAcc: **98.70%**). Confusion analysis shows high-penalty confusion at 16.57%, with most confusion between similar chart types (S↔B, L↔A, B↔H). The model demonstrates strong generalization and robustness on the DocFigure validation set.

## Environmental Impact

- **Hardware Type:** NVIDIA V100 GPU
- **Hours used:** 8
- **Cloud Provider:** Google Cloud
- **Compute Region:** us-central1
- **Carbon Emitted:** ~12 kg CO2eq (estimated)

## Technical Specifications

### Model Architecture and Objective

- ResNet-50 backbone
- Image classification head for 28 classes

### Compute Infrastructure

- **Hardware:** NVIDIA V100 GPU
- **Software:** PyTorch 1.13, torchvision 0.14, Python 3.9

## Citation

**BibTeX:**

```bibtex
@article{DocFigure2021,
  title={DocFigure: A Dataset for Scientific Figure Classification},
  author={S. Afzal, et al.},
  journal={arXiv preprint arXiv:2106.01841},
  year={2021}
}
```

**APA:**

Afzal, S., et al. (2021). DocFigure: A Dataset for Scientific Figure Classification. arXiv preprint arXiv:2106.01841.

## Glossary

- **Chart Type:** The category of a scientific figure (e.g., bar plot, scatter plot, etc.)

## More Information

- [DocFigure Paper](https://arxiv.org/abs/2106.01841)

## Model Card Authors

Hansheng Zhu

## Model Card Contact

[email protected]