This project provides a tool to detect and extract key information from trading charts, such as the symbol title and last price pill, using computer vision techniques. The tool leverages the YOLO (You Only Look Once) object detection model to accurately identify and label these elements in chart images.
The model is trained on a custom dataset of trading chart images annotated with bounding boxes around the symbol_title and last_price_pill. You can find the labelled dataset here. The following image shows an example of the training data with labeled regions:
You can find the pre-trained model available on the Huggingface Model Hub: https://huggingface.co/StephanAkkerman/chart-info-detector. With the instructions on how to use the pre-trained model.
The model detects the symbol_title and last_price_pill in trading chart images as shown below:
The detected regions can then be further processed using OCR (Optical Character Recognition) to extract the textual information.
The required packages to run this code can be found in the requirements.txt file. To run this file, execute the following code block after cloning the repository:
pip install -r requirements.txtor
pip install git+https://github.com/StephanAkkerman/chart-info-detector.gitTo train the YOLO model on your dataset, run the following command in your terminal:
python src/main.pyTo set up wandb for it, simply run the following command before training:
wandb loginAnd then enable wandb in the settings with:
yolo settings wandb=TrueI have already labelled a dataset of trading chart images using Label Studio which are availble on this Hugginface dataset repo: https://huggingface.co/datasets/StephanAkkerman/chart-info-yolo. If you want to label your own dataset, follow the instructions below.
After installing Label Studio using the command in the Installation section, you can start a new labelling project by running the following command in your terminal:
label-studioUse the following XML code snippet as the labeling configuration:
<View>
<Image name="img" value="$image"/>
<RectangleLabels name="label" toName="img">
<Label value="symbol_title" background="#1f77b4"/>
<Label value="last_price_pill" background="#ff7f0e"/>
</RectangleLabels>
</View>Then, import your images into the project and start labelling the symbol_title and last_price_pill regions in each image. After you have finished labelling, you can export the annotations in YOLO format.
To do this, go to the "Export" tab in Label Studio, select "YOLO format", and download the annotations.
Afterwards you need to clean up the exported files. Make sure that the directory structure matches the expected format for training. I have made some scripts to help with this process in the dataset_creation folder.
- Move the images and their corresponding
.txtannotation files into a single directory structure like this:
datasets/
└── tradingview/
├── images/
│ ├── train/
│ └── val/
└── labels/
├── train/
└── val/
- Ensure that the
data.ymlfile in thedatasets/tradingview/directory is correctly set up to point to the training and validation image and label directories. - Verify that the class names in the
data.ymlfile match the labels you used during annotation (symbol_titleandlast_price_pill). - Run the
align_label_files.pyscript in thedataset_creationfolder to ensure that all images have corresponding label files and vice versa. - Run
check_yolo_dataset.pyscript in thedataset_creationfolder to verify the integrity of the dataset.
If you use this project in your research, please cite as follows:
@misc{chart_info_detector_2025,
author = {Stephan Akkerman},
title = {Chart Info Detector},
year = {2025},
publisher = {GitHub},
journal = {GitHub repository},
howpublished = {\url{https://github.com/StephanAkkerman/chart-info-detector}}
}Contributions are welcome! If you have a feature request, bug report, or proposal for code refactoring, please feel free to open an issue on GitHub. We appreciate your help in improving this project.
This project is licensed under the MIT License. See the LICENSE file for details.

