YOLOv7 Finetuned Figure/Graph Detection Model
This repository provides a YOLOv7 model finetuned for detecting figures and graphs in document images, such as those found in scientific papers. The model and code are open for public use and research.
Model Overview
- Base Model: YOLOv7
- Task: Figure/Graph detection in document images
- Finetuned on: Custom dataset of figures and graphs
Quick Start
1. Clone the repository and install dependencies
# Clone this repository
cd https://huggingface.co/vichetkao/graph_detection_model
python -m venv .venv
.\.venv\Scripts\activate
cd ../..
pip install -r requirements.txt
2. Download the Model Weights
Download the best.pt weights from this Hugging Face model page and place it in run/train/weights/best.pt or specify the path with --weights.
3. Run Detection
You can run detection on your images using the provided script:
python run_detect_testing.py --source "testing" --name testing_graph_bbox --device 0
--source: Path to your image folder or file (default:testing)--weights: (Optional) Path to your model weights (best.pt)--device: Set to0for GPU orcpufor CPU inference
4. Output
- Results will be saved in
run/detect/testing_graph_bbox - YOLO label files will be in
run/detect/testing_graph_bbox/labels
Example Detection Results
Below are some example detection results from the model:
Evaluation Results
The following plots show the evaluation metrics and analysis of the model's performance:
import subprocess
subprocess.call([
"python", "run_detect_testing.py",
"--source", "testing",
"--weights", "run/train/weights/best.pt",
"--device", "0"
])
Files
run_detect_testing.py: Main script to run detectiondetect.py: YOLOv7 detection logicrequirements.txt: Python dependenciesrun_detect_testing.bat: Windows batch file for quick testing
Citation
If you use this model, please cite the original YOLOv7 paper and this repository.
License & Credits
This project is released under an open-source license for research and educational use.
Author & Credits
Author: Kao Vichet
Bachelor Student, Cambodia Academy of Digital Technology
AI Full Stack Developer Internship, Techo Startup Center
LinkedIn: https://www.linkedin.com/in/vichet-kao/