lyuwenyu / RT-DETR

[CVPR 2024] Official RT-DETR (RTDETR paddle pytorch), Real-Time DEtection TRansformer, DETRs Beat YOLOs on Real-time Object Detection. 🔥 🔥 🔥
Apache License 2.0
2.71k stars 310 forks source link

RT-DETR 训练数学公式 #39

Open jingeyijie opened 1 year ago

jingeyijie commented 1 year ago

我想用RT-DETR模型训练数学公式,数据集有了,只有一个类别数学公式。但是训练结果不如意。 这里有没有好的一些参考呢

lyuwenyu commented 1 year ago

数学公式是啥啊?

是这种问题嘛 https://github.com/PaddlePaddle/PaddleDetection/issues/8430

jingeyijie commented 1 year ago

例如:小学生的试卷。 我想通过 RT—DETR模型训练,然后可以检测出照片中的数学公式,如 4+5=9 我现在是设置了 num_classes: 1 新增了自己的数学公式类别: { "supercategory": "formula", "id": 1, "name": "mathematical formula" } 自己的数据集,按照格式要求转换了。

训练命令:python -m paddle.distributed.launch --gpus 0,1,2,3 tools/train.py -c configs/rtdetr/rtdetr_r50vd_6x_coco.yml --fleet --eval

但是训练结束过程中AP基本都是0,然后测试的时候检测的结果不理想。

  1. 有没有类似成功的案例,关于数学公式检测的。
  2. 如果同样的数据集继续训练收敛,是不是 python -m paddle.distributed.launch --gpus 0,1,2,3 tools/train.py -c configs/rtdetr/rtdetr_r50vd_6x_coco.yml --fleet --eval 直接用即可。
lyuwenyu commented 1 year ago

理论上是的 之前没有做过数学公式检测能给个图看看嘛,得确定下是( 数据内容 or 只是1类的)训练不出来的问题

jingeyijie commented 1 year ago

aec_0

jingeyijie commented 1 year ago

DONE (t=0.01s). Average Precision (AP) @[ IoU=0.50:0.95 | area= all | maxDets=100 ] = 0.000 Average Precision (AP) @[ IoU=0.50 | area= all | maxDets=100 ] = 0.000 Average Precision (AP) @[ IoU=0.75 | area= all | maxDets=100 ] = 0.000 Average Precision (AP) @[ IoU=0.50:0.95 | area= small | maxDets=100 ] = -1.000 Average Precision (AP) @[ IoU=0.50:0.95 | area=medium | maxDets=100 ] = 0.000 Average Precision (AP) @[ IoU=0.50:0.95 | area= large | maxDets=100 ] = 0.000 Average Recall (AR) @[ IoU=0.50:0.95 | area= all | maxDets= 1 ] = 0.000 Average Recall (AR) @[ IoU=0.50:0.95 | area= all | maxDets= 10 ] = 0.000 Average Recall (AR) @[ IoU=0.50:0.95 | area= all | maxDets=100 ] = 0.000 Average Recall (AR) @[ IoU=0.50:0.95 | area= small | maxDets=100 ] = -1.000 Average Recall (AR) @[ IoU=0.50:0.95 | area=medium | maxDets=100 ] = 0.000 Average Recall (AR) @[ IoU=0.50:0.95 | area= large | maxDets=100 ] = 0.000 一直都是0

lyuwenyu commented 1 year ago

改成两类试一下,, 有试过其他检测器嘛

jingeyijie commented 1 year ago

没有尝试其他检测器。这边要求要用RT-DETR模型的。

lyuwenyu commented 1 year ago

那就先确定下是不是做1类检测效果的不行

lyuwenyu commented 1 year ago

没有尝试其他检测器。这边要求要用RT-DETR模型的。

@jingeyijie

方便透露一下什么单位嘛😳

jingeyijie commented 1 year ago

研究生毕业论文

lyuwenyu commented 1 year ago

检测一下数据格式 box format等

jingeyijie commented 1 year ago

我设置了两个类别,AP还全是0

Average Precision (AP) @[ IoU=0.50:0.95 | area= all | maxDets=100 ] = 0.000 Average Precision (AP) @[ IoU=0.50 | area= all | maxDets=100 ] = 0.000 Average Precision (AP) @[ IoU=0.75 | area= all | maxDets=100 ] = 0.000 Average Precision (AP) @[ IoU=0.50:0.95 | area= small | maxDets=100 ] = -1.000 Average Precision (AP) @[ IoU=0.50:0.95 | area=medium | maxDets=100 ] = 0.000 Average Precision (AP) @[ IoU=0.50:0.95 | area= large | maxDets=100 ] = 0.000 Average Recall (AR) @[ IoU=0.50:0.95 | area= all | maxDets= 1 ] = 0.000 Average Recall (AR) @[ IoU=0.50:0.95 | area= all | maxDets= 10 ] = 0.000 Average Recall (AR) @[ IoU=0.50:0.95 | area= all | maxDets=100 ] = 0.000 Average Recall (AR) @[ IoU=0.50:0.95 | area= small | maxDets=100 ] = -1.000 Average Recall (AR) @[ IoU=0.50:0.95 | area=medium | maxDets=100 ] = 0.000 Average Recall (AR) @[ IoU=0.50:0.95 | area= large | maxDets=100 ] = 0.000 [08/21 00:00:15] ppdet.engine INFO: Total sample number: 1000, average FPS: 21.3426494658262 [08/21 00:00:15] ppdet.engine INFO: Best test bbox ap is 0.000.

lyuwenyu commented 1 year ago

坐标是xywh嘛 xy是box的左上角

jingeyijie commented 1 year ago

坐标是 xywh的。 xy是box的左上角

jingeyijie commented 1 year ago

理论上是不是这类数学公式是可以训练出来的? 只需要训练数学公式一个类型的。 image

lyuwenyu commented 1 year ago

这个感觉问题不大吧 但是之前确实没有跑过类似的数据

jingeyijie commented 1 year ago

我昨天检查了 box 坐标都OK,还尝试了其他的预模型。但是训练过程中还是AP都是0,我理解这个就是有问题的吧。

Average Precision (AP) @[ IoU=0.50:0.95 | area= all | maxDets=100 ] = 0.000 Average Precision (AP) @[ IoU=0.50 | area= all | maxDets=100 ] = 0.000 Average Precision (AP) @[ IoU=0.75 | area= all | maxDets=100 ] = 0.000 Average Precision (AP) @[ IoU=0.50:0.95 | area= small | maxDets=100 ] = -1.000 Average Precision (AP) @[ IoU=0.50:0.95 | area=medium | maxDets=100 ] = 0.000 Average Precision (AP) @[ IoU=0.50:0.95 | area= large | maxDets=100 ] = 0.000 Average Recall (AR) @[ IoU=0.50:0.95 | area= all | maxDets= 1 ] = 0.000 Average Recall (AR) @[ IoU=0.50:0.95 | area= all | maxDets= 10 ] = 0.000 Average Recall (AR) @[ IoU=0.50:0.95 | area= all | maxDets=100 ] = 0.000 Average Recall (AR) @[ IoU=0.50:0.95 | area= small | maxDets=100 ] = -1.000 Average Recall (AR) @[ IoU=0.50:0.95 | area=medium | maxDets=100 ] = 0.000 Average Recall (AR) @[ IoU=0.50:0.95 | area= large | maxDets=100 ] = 0.000

jingeyijie commented 1 year ago

这里我需要修改哪些参数。我按照文档要求改了: coco_detection.yml 指定自己数据集路径,num_classes 改为了1 然后就没改其他的内容。

lyuwenyu commented 1 year ago

其他是不需要改的了

jingeyijie commented 1 year ago

要不我把我的数据集上传,帮我看看哪里出了问题?

jingeyijie commented 1 year ago

我换了 fcos 模型训练是成功的。 RT-DETR 训练不行的。