PaddlePaddle / PaddleDetection

Object Detection toolkit based on PaddlePaddle. It supports object detection, instance segmentation, multiple object tracking and real-time multi-person keypoint detection.
Apache License 2.0
12.79k stars 2.89k forks source link

自己的数据训练表格检测。预训练模型用的是picodet_lcnet_x1_0_fgd_layout_table。检测的时候表格底部有时候会不准,原因是什么呢?要怎么优化呢? #8203

Closed rexzhengzhihong closed 10 months ago

rexzhengzhihong commented 1 year ago

问题确认 Search before asking

请提出你的问题 Please ask your question

问题:样本为25张。评估都是1。可是预测的结果有一些是不准的。比如表格的底部范围错了,怎么优化呢?如图

gdzc_v1-10 gdzc_v1-09

评估结果

python tools/eval.py \
> -c configs/picodet/legacy_model/application/layout_analysis/picodet_lcnet_x1_0_layout_table.yml \
> -o weights=/home/DiskA/zncsPython/table_det/model/output_table/picodet_lcnet_x1_0_layout_table/best_model

W0508 09:32:15.859894 466581 gpu_resources.cc:61] Please NOTE: device: 0, GPU Compute Capability: 8.6, Driver API Version: 11.6, Runtime API Version: 11.6
W0508 09:32:15.862742 466581 gpu_resources.cc:91] device: 0, cuDNN Version: 8.4.
loading annotations into memory...
Done (t=0.00s)
creating index...
index created!
[05/08 09:32:16] ppdet.data.source.coco INFO: Load [7 samples valid, 0 samples invalid] in file /home/DiskA/zncsPython/table_det/coco_data/annotations/instance_val.json.
[05/08 09:32:16] ppdet.utils.checkpoint INFO: Finish loading model weights: /home/DiskA/zncsPython/table_det/model/output_table/picodet_lcnet_x1_0_layout_table/best_model.pdparams
[05/08 09:32:18] ppdet.engine INFO: Eval iter: 0
[05/08 09:32:18] ppdet.metrics.metrics INFO: The bbox result is saved to bbox.json.
loading annotations into memory...
Done (t=0.00s)
creating index...
index created!
[05/08 09:32:18] ppdet.metrics.coco_utils INFO: Start evaluate...
Loading and preparing results...
DONE (t=0.00s)
creating index...
index created!
Running per image evaluation...
Evaluate annotation type *bbox*
DONE (t=0.00s).
Accumulating evaluation results...
DONE (t=0.00s).
 Average Precision  (AP) @[ IoU=0.50:0.95 | area=   all | maxDets=100 ] = 1.000
 Average Precision  (AP) @[ IoU=0.50      | area=   all | maxDets=100 ] = 1.000
 Average Precision  (AP) @[ IoU=0.75      | area=   all | maxDets=100 ] = 1.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 ] = -1.000
 Average Precision  (AP) @[ IoU=0.50:0.95 | area= large | maxDets=100 ] = 1.000
 Average Recall     (AR) @[ IoU=0.50:0.95 | area=   all | maxDets=  1 ] = 1.000
 Average Recall     (AR) @[ IoU=0.50:0.95 | area=   all | maxDets= 10 ] = 1.000
 Average Recall     (AR) @[ IoU=0.50:0.95 | area=   all | maxDets=100 ] = 1.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 ] = -1.000
 Average Recall     (AR) @[ IoU=0.50:0.95 | area= large | maxDets=100 ] = 1.000
[05/08 09:32:18] ppdet.engine INFO: Total sample number: 7, average FPS: 4.0349411184269295

训练配置文件yml

_BASE_: [
  '../../../../runtime.yml',
  '../../_base_/picodet_esnet.yml',
  '../../_base_/optimizer_100e.yml',
  '../../_base_/picodet_640_reader.yml',
]

pretrain_weights: https://paddledet.bj.bcebos.com/models/pretrained/LCNet_x1_0_pretrained.pdparams
save_dir: /home/DiskA/zncsPython/table_det/model/output
#pretrain_weights: https://paddleocr.bj.bcebos.com/ppstructure/models/layout/picodet_lcnet_x1_0_fgd_layout_table.pdparams
#save_dir: /home/DiskA/zncsPython/table_det/model/output_table
#pretrain_weights: https://paddleocr.bj.bcebos.com/ppstructure/models/layout/picodet_lcnet_x1_0_fgd_layout.pdparams
#save_dir: /home/DiskA/zncsPython/table_det/model/output_layout
weights: output/picodet_lcnet_x1_0_layout/model_final

find_unused_parameters: True
use_ema: true
cycle_epoch: 10
snapshot_epoch: 1
epoch: 200

PicoDet:
  backbone: LCNet
  neck: CSPPAN
  head: PicoHead

LCNet:
  scale: 1.0
  feature_maps: [3, 4, 5]

metric: COCO
num_classes: 1

TrainDataset:
  !COCODataSet
    image_dir: train
    anno_path: annotations/instance_train.json
    dataset_dir: /home/DiskA/zncsPython/table_det/coco_data/
    data_fields: ['image', 'gt_bbox', 'gt_class', 'is_crowd']

EvalDataset:
  !COCODataSet
    image_dir: val
    anno_path: annotations/instance_val.json
    dataset_dir: /home/DiskA/zncsPython/table_det/coco_data/

TestDataset:
  !ImageFolder
    anno_path: /home/DiskA/zncsPython/table_det/coco_data/annotations/instance_val.json

worker_num: 2
eval_height: &eval_height 800
eval_width: &eval_width 608
eval_size: &eval_size [*eval_height, *eval_width]

TrainReader:
  sample_transforms:
  - Decode: {}
  - RandomCrop: {}
  - RandomFlip: {prob: 0.5}
  - RandomDistort: {}
  batch_transforms:
  - BatchRandomResize: {target_size: [[768, 576], [800, 608], [832, 640]], random_size: True, random_interp: True, keep_ratio: False}
  - NormalizeImage: {is_scale: true, mean: [0.485,0.456,0.406], std: [0.229, 0.224,0.225]}
  - Permute: {}
  batch_size: 24
  shuffle: true
  drop_last: true
  collate_batch: false

EvalReader:
  sample_transforms:
  - Decode: {}
  - Resize: {interp: 2, target_size: [800, 608], keep_ratio: False}
  - NormalizeImage: {is_scale: true, mean: [0.485,0.456,0.406], std: [0.229, 0.224,0.225]}
  - Permute: {}
  batch_transforms:
  - PadBatch: {pad_to_stride: 32}
  batch_size: 8
  shuffle: false

TestReader:
  inputs_def:
    image_shape: [1, 3, 800, 608]
  sample_transforms:
  - Decode: {}
  - Resize: {interp: 2, target_size: [800, 608], keep_ratio: False}
  - NormalizeImage: {is_scale: true, mean: [0.485,0.456,0.406], std: [0.229, 0.224,0.225]}
  - Permute: {}
  batch_transforms:
  - PadBatch: {pad_to_stride: 32}
  batch_size: 1
  shuffle: false

样本数据

{
    "images": [
        {
            "height": 660,
            "width": 1520,
            "id": 1,
            "file_name": "gdzc_v1-04.jpg"
        },
        {
            "height": 565,
            "width": 1869,
            "id": 2,
            "file_name": "gdzc_v1-18.jpg"
        },
        {
            "height": 630,
            "width": 1517,
            "id": 3,
            "file_name": "gdzc_v1-05.jpg"
        },
        {
            "height": 613,
            "width": 1801,
            "id": 4,
            "file_name": "gdzc_v1-01.jpg"
        },
        {
            "height": 577,
            "width": 1514,
            "id": 5,
            "file_name": "gdzc_v1-08.jpg"
        },
        {
            "height": 434,
            "width": 1517,
            "id": 6,
            "file_name": "gdzc_v1-06.jpg"
        },
        {
            "height": 613,
            "width": 1801,
            "id": 7,
            "file_name": "gdzcljzj_v1_4.png"
        },
        {
            "height": 648,
            "width": 1801,
            "id": 8,
            "file_name": "gdzcljzj_v1_5.png"
        },
        {
            "height": 683,
            "width": 1801,
            "id": 9,
            "file_name": "gdzc_v1-19.jpg"
        },
        {
            "height": 683,
            "width": 1801,
            "id": 10,
            "file_name": "gdzcljzj_v1_3.png"
        },
        {
            "height": 613,
            "width": 1801,
            "id": 11,
            "file_name": "gdzc_v1-13.jpg"
        },
        {
            "height": 494,
            "width": 1090,
            "id": 12,
            "file_name": "gdzc_v1-25.jpg"
        },
        {
            "height": 613,
            "width": 1801,
            "id": 13,
            "file_name": "gdzc_v1-12.jpg"
        },
        {
            "height": 576,
            "width": 1520,
            "id": 14,
            "file_name": "gdzc_v1-07.jpg"
        },
        {
            "height": 494,
            "width": 1088,
            "id": 15,
            "file_name": "gdzc_v1-24.jpg"
        },
        {
            "height": 636,
            "width": 1088,
            "id": 16,
            "file_name": "gdzc_v1-20.jpg"
        },
        {
            "height": 683,
            "width": 1801,
            "id": 17,
            "file_name": "gdzc_v1-14.jpg"
        },
        {
            "height": 683,
            "width": 1801,
            "id": 18,
            "file_name": "gdzcljzj_v1_2.png"
        },
        {
            "height": 494,
            "width": 1520,
            "id": 19,
            "file_name": "gdzc_v1-03.jpg"
        },
        {
            "height": 440,
            "width": 1092,
            "id": 20,
            "file_name": "gdzc_v1-23.jpg"
        },
        {
            "height": 684,
            "width": 1518,
            "id": 21,
            "file_name": "gdzc_v1-09.jpg"
        },
        {
            "height": 660,
            "width": 1521,
            "id": 22,
            "file_name": "gdzc_v1-10.jpg"
        },
        {
            "height": 572,
            "width": 1520,
            "id": 23,
            "file_name": "gdzc_v1-02.jpg"
        },
        {
            "height": 683,
            "width": 1801,
            "id": 24,
            "file_name": "gdzc_v1-16.jpg"
        }
    ],
    "categories": [
        {
            "supercategory": "component",
            "id": 1,
            "name": "Table"
        }
    ],
    "annotations": [
        {
            "segmentation": [
                [
                    10.965811965811966,
                    78.35042735042737,
                    10.965811965811966,
                    643.3076923076924,
                    1508.4017094017095,
                    643.3076923076924,
                    1508.4017094017095,
                    78.35042735042737
                ]
            ],
            "iscrowd": 0,
            "image_id": 1,
            "bbox": [
                10.965811965811966,
                78.35042735042737,
                1497.4358974358975,
                564.957264957265
            ],
            "area": 845987.2890642122,
            "category_id": 1,
            "id": 1
        },
        {
            "segmentation": [
                [
                    18.052631578947366,
                    107.9473684210526,
                    18.052631578947366,
                    512.1578947368421,
                    1854.8947368421052,
                    512.1578947368421,
                    1854.8947368421052,
                    107.9473684210526
                ]
            ],
            "iscrowd": 0,
            "image_id": 2,
            "bbox": [
                18.052631578947366,
                107.9473684210526,
                1836.842105263158,
                404.2105263157895
            ],
            "area": 742470.9141274239,
            "category_id": 1,
            "id": 2
        },
        {
            "segmentation": [
                [
                    12.384615384615385,
                    77.88034188034192,
                    12.384615384615385,
                    613.7777777777778,
                    1507.2564102564104,
                    613.7777777777778,
                    1507.2564102564104,
                    77.88034188034192
                ]
            ],
            "iscrowd": 0,
            "image_id": 3,
            "bbox": [
                12.384615384615385,
                77.88034188034192,
                1494.871794871795,
                535.8974358974359
            ],
            "area": 801097.9618671926,
            "category_id": 1,
            "id": 3
        },
        {
            "segmentation": [
                [
                    19.191919191919194,
                    100.78787878787881,
                    19.191919191919194,
                    483.61616161616166,
                    1781.8181818181818,
                    483.61616161616166,
                    1781.8181818181818,
                    100.78787878787881
                ]
            ],
            "iscrowd": 0,
            "image_id": 4,
            "bbox": [
                19.191919191919194,
                100.78787878787881,
                1762.6262626262626,
                382.82828282828285
            ],
            "area": 674783.185389246,
            "category_id": 1,
            "id": 4
        },
        {
            "segmentation": [
                [
                    13.094017094017094,
                    75.66666666666669,
                    13.094017094017094,
                    556.0085470085471,
                    1507.1111111111113,
                    556.0085470085471,
                    1507.1111111111113,
                    75.66666666666669
                ]
            ],
            "iscrowd": 0,
            "image_id": 5,
            "bbox": [
                13.094017094017094,
                75.66666666666669,
                1494.0170940170942,
                480.3418803418804
            ],
            "area": 717638.980203083,
            "category_id": 1,
            "id": 5
        },
        {
            "segmentation": [
                [
                    8.965811965811966,
                    76.46153846153851,
                    8.965811965811966,
                    418.34188034188037,
                    1506.4017094017095,
                    418.34188034188037,
                    1506.4017094017095,
                    76.46153846153851
                ]
            ],
            "iscrowd": 0,
            "image_id": 6,
            "bbox": [
                8.965811965811966,
                76.46153846153851,
                1497.4358974358975,
                341.88034188034186
            ],
            "area": 511943.89655928116,
            "category_id": 1,
            "id": 6
        },
        {
            "segmentation": [
                [
                    21.052631578947366,
                    97.52631578947364,
                    21.052631578947366,
                    484.8947368421052,
                    1783.157894736842,
                    484.8947368421052,
                    1783.157894736842,
                    97.52631578947364
                ]
            ],
            "iscrowd": 0,
            "image_id": 7,
            "bbox": [
                21.052631578947366,
                97.52631578947364,
                1762.1052631578948,
                387.36842105263156
            ],
            "area": 682583.9335180055,
            "category_id": 1,
            "id": 7
        },
        {
            "segmentation": [
                [
                    17.89473684210526,
                    101.84210526315786,
                    17.89473684210526,
                    521.8421052631578,
                    1783.157894736842,
                    521.8421052631578,
                    1783.157894736842,
                    101.84210526315786
                ]
            ],
            "iscrowd": 0,
            "image_id": 8,
            "bbox": [
                17.89473684210526,
                101.84210526315786,
                1765.2631578947369,
                419.99999999999994
            ],
            "area": 741410.5263157894,
            "category_id": 1,
            "id": 8
        },
        {
            "segmentation": [
                [
                    19.191919191919194,
                    101.44444444444446,
                    19.191919191919194,
                    559.0202020202021,
                    1784.8484848484848,
                    559.0202020202021,
                    1784.8484848484848,
                    101.44444444444446
                ]
            ],
            "iscrowd": 0,
            "image_id": 9,
            "bbox": [
                19.191919191919194,
                101.44444444444446,
                1765.6565656565656,
                457.5757575757576
            ],
            "area": 807921.6406489135,
            "category_id": 1,
            "id": 9
        },
        {
            "segmentation": [
                [
                    18.94736842105263,
                    99.8947368421052,
                    18.94736842105263,
                    556.7368421052631,
                    1782.1052631578946,
                    556.7368421052631,
                    1782.1052631578946,
                    99.8947368421052
                ]
            ],
            "iscrowd": 0,
            "image_id": 10,
            "bbox": [
                18.94736842105263,
                99.8947368421052,
                1763.1578947368419,
                456.8421052631579
            ],
            "area": 805484.7645429362,
            "category_id": 1,
            "id": 10
        },
        {
            "segmentation": [
                [
                    16.161616161616163,
                    97.75757575757575,
                    16.161616161616163,
                    489.67676767676767,
                    1784.8484848484848,
                    489.67676767676767,
                    1784.8484848484848,
                    97.75757575757575
                ]
            ],
            "iscrowd": 0,
            "image_id": 11,
            "bbox": [
                16.161616161616163,
                97.75757575757575,
                1768.6868686868686,
                391.9191919191919
            ],
            "area": 693182.3283338435,
            "category_id": 1,
            "id": 11
        },
        {
            "segmentation": [
                [
                    13.11042944785276,
                    78.23926380368096,
                    13.11042944785276,
                    473.9447852760736,
                    1078.1411042944785,
                    473.9447852760736,
                    1078.1411042944785,
                    78.23926380368096
                ]
            ],
            "iscrowd": 0,
            "image_id": 12,
            "bbox": [
                13.11042944785276,
                78.23926380368096,
                1065.0306748466257,
                395.70552147239266
            ],
            "area": 421438.51857427834,
            "category_id": 1,
            "id": 12
        },
        {
            "segmentation": [
                [
                    17.171717171717173,
                    96.74747474747477,
                    17.171717171717173,
                    491.69696969696975,
                    1783.8383838383838,
                    491.69696969696975,
                    1783.8383838383838,
                    96.74747474747477
                ]
            ],
            "iscrowd": 0,
            "image_id": 13,
            "bbox": [
                17.171717171717173,
                96.74747474747477,
                1766.6666666666667,
                394.949494949495
            ],
            "area": 697744.1077441078,
            "category_id": 1,
            "id": 13
        },
        {
            "segmentation": [
                [
                    14.384615384615385,
                    75.66666666666669,
                    14.384615384615385,
                    555.1538461538462,
                    1510.965811965812,
                    555.1538461538462,
                    1510.965811965812,
                    75.66666666666669
                ]
            ],
            "iscrowd": 0,
            "image_id": 14,
            "bbox": [
                14.384615384615385,
                75.66666666666669,
                1496.5811965811965,
                479.4871794871795
            ],
            "area": 717591.496822266,
            "category_id": 1,
            "id": 14
        },
        {
            "segmentation": [
                [
                    13.950920245398772,
                    78.23926380368096,
                    13.950920245398772,
                    474.55828220858893,
                    1075.9141104294479,
                    474.55828220858893,
                    1075.9141104294479,
                    78.23926380368096
                ]
            ],
            "iscrowd": 0,
            "image_id": 15,
            "bbox": [
                13.950920245398772,
                78.23926380368096,
                1061.9631901840492,
                396.319018404908
            ],
            "area": 420876.20911588694,
            "category_id": 1,
            "id": 15
        },
        {
            "segmentation": [
                [
                    17.01840490797546,
                    82.3680981595092,
                    17.01840490797546,
                    616.1104294478528,
                    1075.3006134969323,
                    616.1104294478528,
                    1075.3006134969323,
                    82.3680981595092
                ]
            ],
            "iscrowd": 0,
            "image_id": 16,
            "bbox": [
                17.01840490797546,
                82.3680981595092,
                1058.2822085889568,
                533.7423312883436
            ],
            "area": 564850.013173247,
            "category_id": 1,
            "id": 16
        },
        {
            "segmentation": [
                [
                    19.191919191919194,
                    96.39393939393938,
                    19.191919191919194,
                    561.040404040404,
                    1784.8484848484848,
                    561.040404040404,
                    1784.8484848484848,
                    96.39393939393938
                ]
            ],
            "iscrowd": 0,
            "image_id": 17,
            "bbox": [
                19.191919191919194,
                96.39393939393938,
                1765.6565656565656,
                464.64646464646466
            ],
            "area": 820406.0810121417,
            "category_id": 1,
            "id": 17
        },
        {
            "segmentation": [
                [
                    14.736842105263158,
                    97.78947368421052,
                    14.736842105263158,
                    555.6842105263157,
                    1784.2105263157894,
                    555.6842105263157,
                    1784.2105263157894,
                    97.78947368421052
                ]
            ],
            "iscrowd": 0,
            "image_id": 18,
            "bbox": [
                14.736842105263158,
                97.78947368421052,
                1769.4736842105262,
                457.8947368421052
            ],
            "area": 810232.6869806093,
            "category_id": 1,
            "id": 18
        },
        {
            "segmentation": [
                [
                    15.239316239316242,
                    79.11111111111114,
                    15.239316239316242,
                    478.2564102564103,
                    1509.2564102564104,
                    478.2564102564103,
                    1509.2564102564104,
                    79.11111111111114
                ]
            ],
            "iscrowd": 0,
            "image_id": 19,
            "bbox": [
                15.239316239316242,
                79.11111111111114,
                1494.0170940170942,
                399.14529914529913
            ],
            "area": 596329.8999196435,
            "category_id": 1,
            "id": 19
        },
        {
            "segmentation": [
                [
                    17.177914110429448,
                    78.84662576687117,
                    17.177914110429448,
                    417.49693251533733,
                    1073.6196319018404,
                    417.49693251533733,
                    1073.6196319018404,
                    78.84662576687117
                ]
            ],
            "iscrowd": 0,
            "image_id": 20,
            "bbox": [
                17.177914110429448,
                78.84662576687117,
                1056.441717791411,
                338.65030674846616
            ],
            "area": 357764.31179193786,
            "category_id": 1,
            "id": 20
        },
        {
            "segmentation": [
                [
                    15.094017094017094,
                    77.52991452991455,
                    15.094017094017094,
                    666.4188034188035,
                    1511.6752136752139,
                    666.4188034188035,
                    1511.6752136752139,
                    77.52991452991455
                ]
            ],
            "iscrowd": 0,
            "image_id": 21,
            "bbox": [
                15.094017094017094,
                77.52991452991455,
                1496.5811965811968,
                588.8888888888889
            ],
            "area": 881320.0379867048,
            "category_id": 1,
            "id": 21
        },
        {
            "segmentation": [
                [
                    12.675213675213676,
                    76.64102564102564,
                    12.675213675213676,
                    644.1623931623932,
                    1509.2564102564104,
                    644.1623931623932,
                    1509.2564102564104,
                    76.64102564102564
                ]
            ],
            "iscrowd": 0,
            "image_id": 22,
            "bbox": [
                12.675213675213676,
                76.64102564102564,
                1496.5811965811968,
                567.5213675213676
            ],
            "area": 849341.8072905254,
            "category_id": 1,
            "id": 22
        },
        {
            "segmentation": [
                [
                    16.094017094017094,
                    78.79487179487182,
                    16.094017094017094,
                    558.2820512820514,
                    1508.4017094017095,
                    558.2820512820514,
                    1508.4017094017095,
                    78.79487179487182
                ]
            ],
            "iscrowd": 0,
            "image_id": 23,
            "bbox": [
                16.094017094017094,
                78.79487179487182,
                1492.3076923076924,
                479.48717948717956
            ],
            "area": 715542.4063116373,
            "category_id": 1,
            "id": 23
        },
        {
            "segmentation": [
                [
                    20.2020202020202,
                    100.43434343434342,
                    20.2020202020202,
                    558.010101010101,
                    1785.858585858586,
                    558.010101010101,
                    1785.858585858586,
                    100.43434343434342
                ]
            ],
            "iscrowd": 0,
            "image_id": 24,
            "bbox": [
                20.2020202020202,
                100.43434343434342,
                1765.6565656565658,
                457.5757575757576
            ],
            "area": 807921.6406489136,
            "category_id": 1,
            "id": 24
        }
    ]
}
rexzhengzhihong commented 10 months ago

没人回答吗

rexzhengzhihong commented 10 months ago

@thinkthinking

thinkthinking commented 10 months ago

@thinkthinkin

thinkthinking commented 10 months ago

@lyuwenyu