PaddlePaddle / PaddleYOLO

🚀🚀🚀 YOLO series of PaddlePaddle implementation, PP-YOLOE+, RT-DETR, YOLOv5, YOLOv6, YOLOv7, YOLOv8, YOLOv10, YOLOX, YOLOv5u, YOLOv7u, YOLOv6Lite, RTMDet and so on. 🚀🚀🚀
https://github.com/PaddlePaddle/PaddleYOLO
GNU General Public License v3.0
547 stars 133 forks source link

PCB_coco数据 训练报错 #149

Closed hbo-lambda closed 6 months ago

hbo-lambda commented 1 year ago

问题确认 Search before asking

请提出你的问题 Please ask your question

Snip20230531_2

配置文件修改: Snip20230531_4

因为报错,所以在358行代码中添加了打印 Snip20230531_3

第一个batch有值,第二个batch就成了[],好纳闷

执行的命令:

python tools/train.py -c configs/yolov5u/yolov5up6_s_300e_coco.yml

有可能是我有遗漏,也许是本来就有bug。同样的数据集,换成 python tools/train.py -c configs/ppyoloe/ppyoloe_plus_crn_s_80e_coco.yml 就可以执行训练

nemonameless commented 1 year ago

coco数据集上均没有此类似报错,建议重新检查下数据集制作,排除空标注或不合理标注框,同时reader里去除mosaic再试试

mosaic_epoch: &mosaic_epoch -1 
worker_num: 4
TrainReader:
  sample_transforms:
    - Decode: {}
    - MosaicPerspective: {mosaic_prob: 0.0, target_size: *input_size}
   .......
nemonameless commented 1 year ago

https://github.com/PaddlePaddle/PaddleYOLO/issues/43 image

此外单卡训总bs太小了,gt是不是每张图也很少?这样容易mosaic后无框。建议扩大bs,模型不用选p6,你单卡训精度都不一定有常规p5模型开大bs训来的高

hbo-lambda commented 1 year ago

43 image

此外单卡训总bs太小了,gt是不是每张图也很少?这样容易mosaic后无框。建议扩大bs,模型不用选p6,你单卡训精度都不一定有常规p5模型开大bs训来的高

为了寻找报错的原因,所以将bs搞成了1。我用的是tt100k,它的图像是2048*2048的,道路标识又有点小,所以用了p6。我是coco数据集的,可以运行。依照提示修改了mosaic_prob后,用自己的数据集就会卡住。换成voc数据格式后,也会报那个错。

检查了数据集后,没有发现空标注,xmin、ymin、xmax、ymax的数据也合规。贴一个xml数据


                <annotation>
                    <folder>train</folder>
                    <filename>36319.jpg</filename>
                    <size>
                        <width>2048</width>
                        <height>2048</height>
                        <depth>3</depth>
                    </size>
                    <segmented>0</segmented>
                    <object>
                        <name>i2</name>
                        <pose>Unspecified</pose>
                        <truncated>0</truncated>
                        <difficult>0</difficult>
                        <bndbox>
                            <xmin>1550</xmin>
                            <ymin>933</ymin>
                            <xmax>1567</xmax>
                            <ymax>952</ymax>
                        </bndbox>
                    </object>

                    <object>
                        <name>i4</name>
                        <pose>Unspecified</pose>
                        <truncated>0</truncated>
                        <difficult>0</difficult>
                        <bndbox>
                            <xmin>1273</xmin>
                            <ymin>912</ymin>
                            <xmax>1296</xmax>
                            <ymax>934</ymax>
                        </bndbox>
                    </object>

                    <object>
                        <name>p10</name>
                        <pose>Unspecified</pose>
                        <truncated>0</truncated>
                        <difficult>0</difficult>
                        <bndbox>
                            <xmin>1496</xmin>
                            <ymin>992</ymin>
                            <xmax>1509</xmax>
                            <ymax>1006</ymax>
                        </bndbox>
                    </object>

                    <object>
                        <name>pl40</name>
                        <pose>Unspecified</pose>
                        <truncated>0</truncated>
                        <difficult>0</difficult>
                        <bndbox>
                            <xmin>1513</xmin>
                            <ymin>932</ymin>
                            <xmax>1529</xmax>
                            <ymax>951</ymax>
                        </bndbox>
                    </object>

                    <object>
                        <name>pl50</name>
                        <pose>Unspecified</pose>
                        <truncated>0</truncated>
                        <difficult>0</difficult>
                        <bndbox>
                            <xmin>1460</xmin>
                            <ymin>933</ymin>
                            <xmax>1476</xmax>
                            <ymax>950</ymax>
                        </bndbox>
                    </object>

                    <object>
                        <name>pl70</name>
                        <pose>Unspecified</pose>
                        <truncated>0</truncated>
                        <difficult>0</difficult>
                        <bndbox>
                            <xmin>1440</xmin>
                            <ymin>929</ymin>
                            <xmax>1457</xmax>
                            <ymax>949</ymax>
                        </bndbox>
                    </object>

                    <object>
                        <name>pn</name>
                        <pose>Unspecified</pose>
                        <truncated>0</truncated>
                        <difficult>0</difficult>
                        <bndbox>
                            <xmin>1478</xmin>
                            <ymin>932</ymin>
                            <xmax>1497</xmax>
                            <ymax>953</ymax>
                        </bndbox>
                    </object>

                    <object>
                        <name>pne</name>
                        <pose>Unspecified</pose>
                        <truncated>0</truncated>
                        <difficult>0</difficult>
                        <bndbox>
                            <xmin>1140</xmin>
                            <ymin>906</ymin>
                            <xmax>1164</xmax>
                            <ymax>930</ymax>
                        </bndbox>
                    </object>

                    <object>
                        <name>im</name>
                        <pose>Unspecified</pose>
                        <truncated>0</truncated>
                        <difficult>0</difficult>
                        <bndbox>
                            <xmin>1529</xmin>
                            <ymin>935</ymin>
                            <xmax>1546</xmax>
                            <ymax>954</ymax>
                        </bndbox>
                    </object>
                </annotation>
{
"images": [{"file_name": "36319.jpg", "width": 2048, "height": 2048, "id": 1761}],
"annotations": [{"segmentation": [[1550, 933, 1550, 952, 1567, 952, 1567, 933]], "area": 323, "iscrowd": 0, "image_id": 1761, "bbox": [1550, 933, 17, 19], "category_id": 8, "id": 4781, "ignore": 0}]
}
"category": [{"supercategory": "none", "id": 1, "name": "i1"},....]
nemonameless commented 6 months ago

方便发下tt100k数据集吗,或者可以使用别的ppyoloe+或rtdetr模型