Skip to content

Commit

Permalink
更新README大题分割部分
Browse files Browse the repository at this point in the history
  • Loading branch information
vkgo committed Apr 22, 2023
1 parent 3a97c0b commit 2a50ce9
Show file tree
Hide file tree
Showing 3 changed files with 80 additions and 4 deletions.
Binary file modified README.assets/系统流程图.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
82 changes: 79 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,13 +108,88 @@ OCRAutoScore
+----.gitignore # git忽略的文件夹、文件
```

# 4 大题分割
# 4 作答区域分割-大题分割

在大题分割部分,我们使用了YOLOv8模型,通过使用老师提供的数据集进行训练,最终呈现了十分完美的效果。

## 4.1 YOLOv8

<img src="README.assets/62b5ed8625d6c4a157f1ee7a1c10c4e9.png" alt="YOLOv8来啦 | 详细解读YOLOv8的改进模块!YOLOv5官方出品YOLOv8,必卷! - 智源社区" style="zoom: 67%;" />

YOLOv8是一个包括了图像分类、Anchor-Free物体检测和实例分割的高效算法,检测部分设计参考了目前大量优异的最新的YOLO改进算法,实现了新的SOTA。YOLOv8抛弃了前几代模型的Anchor-Base,是一种基于图像全局信息进行预测的目标检测系统。

# 5 小题分割
与前代相比,YOLOv8有以下不同:

1. 提供了全新的SOTA模型,包括具有P5 640和P6 1280分辨率的目标检测网络以及基于YOLACT的实例分割模型。与YOLOv5类似,还提供了不同大小的N/S/M/L/X比例模型,根据缩放系数来满足不同场景需求。

2. 骨干网络和Neck部分可能参考了YOLOv7 ELAN的设计思路。在YOLOv5中,C3结构被替换为具有更丰富梯度流动性的C2f结构。对于不同比例模型进行了不同通道数量调整,并经过精心微调而非盲目应用一组参数到所有模型上,大大提高了模型性能。然而,在这个C2f模块中存在一些操作(如Split)并不像之前那样适合特定硬件部署。

3. 与YOLOv5相比,在Head部分进行了重大改变,采用主流解耦头结构将分类和检测头分离,并从Anchor-Based转向Anchor-Free。

4. 在损失计算策略方面,采用TaskAlignedAssigner正样本分配策略以及引入Distribution Focal Loss。

5. 在训练过程中进行数据增强时,引入自YOLOX关闭Mosaic增强操作后10个epoch可以有效提高准确性。

YOLOv8作为一种实时目标检测算法,可能被应用于多种场景,包括但不限于:

- 无人驾驶汽车:实时检测道路上的行人、车辆、交通信号等目标,为自动驾驶系统提供关键信息。
- 视频监控:实时检测和跟踪安全系统中的异常行为,如闯入、偷窃等。
- 工业自动化:用于产品质量检测、机器人导航等领域。
- 无人机航拍:实时目标检测和跟踪,为无人机提供导航和避障能力。

此处,我们将其应用于大题分割,也就是,在我们提供的整张试卷中,找到对应的大题(如:客观题、填空题、主观题等)。

## 4.2 单独执行大题分割

大题分割源码在`segmentation/Layout4Card`,也可以通过URLhttps://github.com/vkgo/OCRAutoScore/blob/3a97c0bd2b32abdeaba7c7c0bfa5106bdaee4479/segmentation/Layout4Card进入我们仓库中大题分割的目录查看、复制、运行。

`infer.py`是一个推理代码的示范,在这之中:

1. CLS_ID_NAME_MAP是一个字典,里面有我们支持的识别类别和它对应的index。
2. model是载入模型,此处可以使用我们训练好的模型不需要改动。
3. folder是将要测试的图片的目录,可以换为测试图片。
4. 运行后,由于`model.predict(source=imgs, save=True, imgsz=640)`中的`save=True`,文件将被村粗在`segmentation/Layout4Card/run`目录之下。

```python
CLS_ID_NAME_MAP = {
0: 'student_id',
1: 'subjective_problem',
2: 'fillin_problem',
3: 'objective_problem'
}

model = YOLO(model='./runs/detect/train3/weights/best.pt')
folder = './testdata'
file_names = os.listdir(folder)

random.shuffle(file_names)

imgs = []
for file_name in file_names[:10]:
img_path = os.path.join(folder, file_name)
img = cv2.imread(img_path)
imgs += [img]
results = model.predict(source=imgs, save=True, imgsz=640)
```

## 4.3 样例

```shell
cd .\segmentation\Layout4Card\
python .\infer.py
```



![image-20230422110046357](README.assets/image-20230422110046357.png)

保存的图片如下::

<img src="README.assets/image-20230422110135175.png" alt="image-20230422110135175" style="zoom: 33%;" />



# 5 作答区域分割-小题分割



Expand All @@ -133,7 +208,8 @@ OCRAutoScore


# 8 填空题模型-公式识别
# 8.1 框架
## 8.1 框架

![CAN模型框架](README.assets/CAN.png)


Expand Down
2 changes: 1 addition & 1 deletion segmentation/Layout4Card/infer.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
}

model = YOLO(model='./runs/detect/train3/weights/best.pt')
folder = '/data02/data/answersheet/1664328181460/6333b2373a83aa4f9a04f640'
folder = './testdata'
file_names = os.listdir(folder)

random.shuffle(file_names)
Expand Down

0 comments on commit 2a50ce9

Please sign in to comment.