https://github.com/liu42/inscriptions
2024 年 MathorCup 数学应用挑战赛 B 题,基于 YOLOv8 的甲骨文原始拓片图像单字分割识别模型。
https://github.com/liu42/inscriptions
computer-vision flask image-classification object-detection onnxruntime opencv webapp yolo yolov8
Last synced: 11 months ago
JSON representation
2024 年 MathorCup 数学应用挑战赛 B 题,基于 YOLOv8 的甲骨文原始拓片图像单字分割识别模型。
- Host: GitHub
- URL: https://github.com/liu42/inscriptions
- Owner: LIU42
- Created: 2024-08-14T08:16:51.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2025-06-29T15:12:04.000Z (12 months ago)
- Last Synced: 2025-07-16T19:39:56.402Z (11 months ago)
- Topics: computer-vision, flask, image-classification, object-detection, onnxruntime, opencv, webapp, yolo, yolov8
- Language: JavaScript
- Homepage:
- Size: 352 KB
- Stars: 26
- Watchers: 1
- Forks: 3
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Inscriptions
*v2.0.0 新变化:项目使用 C/S 架构重新实现。*
## 项目简介
本项目取材自 2024 年 MathorCup 数学应用挑战赛 B 题,基于 YOLOv8 的甲骨文原始拓片图像单字分割识别系统。针对原始拓片图像中的甲骨文文字分割识别包括以下两个阶段:
- 目标检测:基于 YOLOv8 目标检测模型,对甲骨文文字所在的矩形区域进行提取。
- 字符识别:基于 YOLOv8 图像分类模型,对文字图像进行分类,判断该字形所代表的具体字符内容。
同时实现基于 [Flask](https://flask.palletsprojects.com/en/stable/) 的后端推理接口和 Web UI 可视化界面。
## 效果展示

## 性能评估
本项目训练数据集来自 [殷契文渊](https://jgw.aynu.edu.cn/),对原始数据集进行了增强,采用 YOLOv8s 模型进行训练,能识别 其中195 中不同的甲骨文字符,其中目标检测模型各项指标如下:
| mAP50 | mAP50-95 | Precision | Recall |
|:-----:|:--------:|:---------:|:------:|
| 0.928 | 0.608 | 0.905 | 0.865 |
字符分类模型各项指标如下:
| Top1_acc | Top5_acc |
|:--------:|:--------:|
| 0.897 | 0.969 |
## 使用说明
首先需要安装本项目依赖的各种库和工具包。
```shell-session
pip install -r requirements.txt
```
可以在本项目 Releases 中下载我训练好的模型权重文件,解压到目录 inferences/models 下,运行以下命令以启动服务端程序。
```shell-session
python -m flask --app servers.server:app run --host=0.0.0.0 --port=8080
```
本项目识别程序默认的配置文件为 inferences/configs/config.toml,其中各个字段的描述如下。
| 字段名 | 字段描述 |
|:-------------------------:|:-----------------------------------------:|
| providers | 模型推理 ONNX Runtime Execution Providers 列表。 |
| precision | 推理运算精度,可取 "fp32"(单精度)或 "fp16"(半精度)。 |
| detection-model-path | 目标检测模型加载路径。 |
| classification-model-path | 字符识别模型加载路径。 |
| conf-threshold | 目标检测置信度阈值。 |
| iou-threshold | 目标检测非极大值抑制 IoU 阈值。 |
客户端程序位于 clients 目录下,可通过 [Nginx](https://nginx.org/en/) 或其他前端服务器部署,其中 clients/js/names.js 内为字符类别名列表,可根据实际需要调整。此外还需要安装配置并启动 [Nginx](https://nginx.org/en/) 服务进行后端服务和前端服务之间的反向代理。
如果需要使用自己的数据集训练模型,则需要安装 Ultralytics 框架,参照 [Ultralytics 官方文档](https://docs.ultralytics.com/) 进行模型的训练,最后将模型转换为 ONNX 格式进行部署即可。
```shell-session
pip install ultralytics
```