hanszhu commited on
Commit
2eb05fd
·
verified ·
1 Parent(s): be251af

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +193 -3
README.md CHANGED
@@ -1,3 +1,193 @@
1
- ---
2
- license: apache-2.0
3
- ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: apache-2.0
3
+ language:
4
+ - en
5
+ base_model:
6
+ - microsoft/resnet-50
7
+ pipeline_tag: image-classification
8
+ ---
9
+
10
+ # Model Card for ChartTypeNet-DocFigure
11
+
12
+ 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.
13
+
14
+ ## Model Details
15
+
16
+ ### Model Description
17
+
18
+ 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.
19
+
20
+ - **Developed by:** Hansheng Zhu
21
+ - **Model type:** Image Classification
22
+ - **License:** Apache-2.0
23
+ - **Finetuned from model:** microsoft/resnet-50
24
+
25
+ ### Model Sources
26
+
27
+ - **Repository:** [https://github.com/hanszhu/ChartSense](https://github.com/hanszhu/ChartSense)
28
+ - **Paper:** https://arxiv.org/abs/2106.01841
29
+
30
+ ## Uses
31
+
32
+ ### Direct Use
33
+
34
+ - Scientific chart type classification from images
35
+ - Preprocessing for document image understanding pipelines
36
+ - Dataset analysis and mining in scientific literature
37
+
38
+ ### Downstream Use
39
+
40
+ - As a preprocessing step for chart element detection or information extraction
41
+ - Integration into document parsing or digital library systems
42
+
43
+ ### Out-of-Scope Use
44
+
45
+ - Classification of non-scientific images
46
+ - Use on charts outside the 28 DocFigure categories
47
+ - Medical or legal decision making
48
+
49
+ ## Bias, Risks, and Limitations
50
+
51
+ - The model is limited to the 28 chart types present in the DocFigure dataset.
52
+ - May not generalize to charts with highly unusual styles or poor image quality.
53
+ - Potential dataset bias: DocFigure is sourced from computer vision conference papers.
54
+
55
+ ### Recommendations
56
+
57
+ Users should verify predictions on out-of-domain data and be aware of the model’s limitations regarding chart style and domain.
58
+
59
+ ## How to Get Started with the Model
60
+
61
+ ```python
62
+ import torch
63
+ from PIL import Image
64
+ from torchvision import transforms
65
+
66
+ # Load model (example, adjust for your codebase)
67
+ model = torch.load('chart_type.pth', map_location='cpu')
68
+ model.eval()
69
+
70
+ # Preprocess image
71
+ img = Image.open('example_chart.png').convert('RGB')
72
+ transform = transforms.Compose([
73
+ transforms.Resize((224, 224)), # or as used in your training
74
+ transforms.ToTensor(),
75
+ transforms.Normalize(mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225])
76
+ ])
77
+ input_tensor = transform(img).unsqueeze(0)
78
+
79
+ # Inference
80
+ with torch.no_grad():
81
+ logits = model(input_tensor)
82
+ pred = logits.argmax(dim=1).item()
83
+
84
+ # Map to label
85
+ chart_type_labels = [
86
+ 'Line graph', 'Natural image', 'Table', '3D object', 'Bar plot', 'Scatter plot',
87
+ 'Medical image', 'Sketch', 'Geographic map', 'Flow chart', 'Heat map', 'Mask',
88
+ 'Block diagram', 'Venn diagram', 'Confusion matrix', 'Histogram', 'Box plot',
89
+ 'Vector plot', 'Pie chart', 'Surface plot', 'Algorithm', 'Contour plot',
90
+ 'Tree diagram', 'Bubble chart', 'Polar plot', 'Area chart', 'Pareto chart', 'Radar chart'
91
+ ]
92
+ print("Predicted chart type:", chart_type_labels[pred])
93
+ ```
94
+
95
+ ## Training Details
96
+
97
+ ### Training Data
98
+
99
+ - **Dataset:** [DocFigure](https://arxiv.org/abs/2106.01841)
100
+ - 33,000 annotated figures from scientific articles (CVPR, ECCV, ICCV, etc.)
101
+ - 28 chart types, manually labeled using a custom web-based tool
102
+
103
+ ### Training Procedure
104
+
105
+ - Images resized to 224x224
106
+ - Normalized using ImageNet statistics
107
+ - **Training regime:** fp32
108
+ - **Optimizer:** Adam
109
+ - **Batch size:** 64
110
+ - **Epochs:** 30
111
+ - **Learning rate:** 1e-4
112
+
113
+ ## Evaluation
114
+
115
+ ### Testing Data, Factors & Metrics
116
+
117
+ - **Testing Data:** Held-out split from DocFigure dataset
118
+ - **Factors:** Chart type, image quality
119
+ - **Metrics:** Accuracy, Similarity-aware Accuracy (SimAcc), Confusion Analysis, F1 score, Precision, Recall
120
+
121
+ ### Results
122
+
123
+ | Metric | Train | Validation |
124
+ |------------------|---------|------------|
125
+ | Accuracy | 95.61% | 86.71% |
126
+ | SimAcc | 98.70% | 96.20% |
127
+ | Best Val Acc | | 87.03% |
128
+ | Total Loss | 1.3843 | 2.2681 |
129
+ | Base Loss | 0.887 | 1.073 |
130
+ | Sim Loss | 0.372 | 1.192 |
131
+ | Cont Loss | 0.125 | 0.004 |
132
+ | Learning Rate | 0.000000| 0.000000 |
133
+
134
+ #### Confusion Analysis
135
+ - High-penalty confusion: 16.57%
136
+ - S↔B: 8 | L↔A: 30 | B↔H: 93
137
+
138
+ #### Summary
139
+
140
+ 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.
141
+
142
+ ## Environmental Impact
143
+
144
+ - **Hardware Type:** NVIDIA V100 GPU
145
+ - **Hours used:** 8
146
+ - **Cloud Provider:** Google Cloud
147
+ - **Compute Region:** us-central1
148
+ - **Carbon Emitted:** ~12 kg CO2eq (estimated)
149
+
150
+ ## Technical Specifications
151
+
152
+ ### Model Architecture and Objective
153
+
154
+ - ResNet-50 backbone
155
+ - Image classification head for 28 classes
156
+
157
+ ### Compute Infrastructure
158
+
159
+ - **Hardware:** NVIDIA V100 GPU
160
+ - **Software:** PyTorch 1.13, torchvision 0.14, Python 3.9
161
+
162
+ ## Citation
163
+
164
+ **BibTeX:**
165
+
166
+ ```bibtex
167
+ @article{DocFigure2021,
168
+ title={DocFigure: A Dataset for Scientific Figure Classification},
169
+ author={S. Afzal, et al.},
170
+ journal={arXiv preprint arXiv:2106.01841},
171
+ year={2021}
172
+ }
173
+ ```
174
+
175
+ **APA:**
176
+
177
+ Afzal, S., et al. (2021). DocFigure: A Dataset for Scientific Figure Classification. arXiv preprint arXiv:2106.01841.
178
+
179
+ ## Glossary
180
+
181
+ - **Chart Type:** The category of a scientific figure (e.g., bar plot, scatter plot, etc.)
182
+
183
+ ## More Information
184
+
185
+ - [DocFigure Paper](https://arxiv.org/abs/2106.01841)
186
+
187
+ ## Model Card Authors
188
+
189
+ Hansheng Zhu
190
+
191
+ ## Model Card Contact
192
+
193