Maintained by 🔗 Omar Moured | 💻 GitHub
Swin-Chart is a Swin Transformer-based model for chart classification across various datasets. It achieved first place in the chart classification task at the ICDAR 2023 CHART Infographics competition.
We introduce Swin-Chart, a Swin Transformer-based model with finetuning and a greedy weight-averaging strategy for chart image classification. The pre-trained Swin Transformer captures both local and global feature dependencies, and after finetuning on chart image datasets, the best model weights are averaged to achieve optimal performance. Experiments on five chart image datasets demonstrate that Swin-Chart outperforms state-of-the-art models across all datasets.
- Training Code
- Testing Code
- Swin-Chart Checkpoints (soon)
- Best Swin-Base Checkpoint
- Greedy Soup Checkpoint (soon)
- Checkpoint Averaging Code (soon)
1. Clone the repository
git clone [https://github.com/yufanchen96/RoDLA.git](https://github.com/moured/Swin-chart.git)
cd Swin-chart
2. Create a conda virtual environment
# create virtual environment
conda create -n swinchart python=3.8 -y
conda activate swinchart
3. Install Dependencies
pip install -r requirements.txt
Download the UB-PMC dataset.
Prepare the dataset for by splitting it into 80% for training and 20% for testing. Modify the dataset paths in ICPR_split.sh, then execute the following command:
bash ICPR_split.sh
1. Modify the train/test dataset split paths and model selection in config.json, You can choose between baseline or large models.
"model_name": "swin_base_patch4_window7_224"
OR
"model_name": "swin_large_patch4_window7_224"
2. Start Training
python train.py
You can download our best model from the Releases page.
1. Modify the test dataset path and model checkpoint in test.sh
2. Start Testing
bash test.sh
If you find this code useful for your research, please consider citing:
@article{DHOTE2024203,
title = {Swin-chart: An efficient approach for chart classification},
journal = {Pattern Recognition Letters},
volume = {185},
pages = {203-209},
year = {2024},
issn = {0167-8655},
doi = {https://doi.org/10.1016/j.patrec.2024.08.012},
url = {https://www.sciencedirect.com/science/article/pii/S0167865524002447},
author = {Anurag Dhote and Mohammed Javed and David S. Doermann},
keywords = {Chart classification, Swin transformer, Deep learning, Scientific documents},
}