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.71k stars 2.87k forks source link

ppdet.engine INFO: Best test bbox ap is 0.000 ap一直是0 #8186

Closed rexzhengzhihong closed 1 year ago

rexzhengzhihong commented 1 year ago

问题确认 Search before asking

请提出你的问题 Please ask your question

ppdet训练命令:

python tools/train.py \
-c configs/picodet/legacy_model/application/layout_analysis/picodet_lcnet_x1_0_layout_table.yml \
--eval

训练日志

[05/05 14:03:37] ppdet.engine INFO: Total sample number: 5, average FPS: 58.089956733459275
[05/05 14:03:37] ppdet.engine INFO: Best test bbox ap is 0.000.
[05/05 14:03:37] ppdet.utils.checkpoint INFO: Save checkpoint: output/picodet_lcnet_x1_0_layout_table
[05/05 14:03:37] ppdet.utils.checkpoint INFO: Save checkpoint: output/picodet_lcnet_x1_0_layout_table
[05/05 14:03:37] ppdet.engine INFO: Eval iter: 0
[05/05 14:03:37] 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/05 14:03:37] 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.01s).
Accumulating evaluation results...
DONE (t=0.00s).
 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 ] = -1.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 ] = -1.000
 Average Recall     (AR) @[ IoU=0.50:0.95 | area= large | maxDets=100 ] = 0.000
[05/05 14:03:37] ppdet.engine INFO: Total sample number: 5, average FPS: 68.73203985317252
[05/05 14:03:37] ppdet.engine INFO: Best test bbox ap is 0.000.
[05/05 14:03:37] ppdet.utils.checkpoint INFO: Save checkpoint: output/picodet_lcnet_x1_0_layout_table
[05/05 14:03:37] ppdet.utils.checkpoint INFO: Save checkpoint: output/picodet_lcnet_x1_0_layout_table
[05/05 14:03:38] ppdet.engine INFO: Eval iter: 0
[05/05 14:03:38] 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/05 14:03:38] 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.01s).
Accumulating evaluation results...
DONE (t=0.00s).
 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 ] = -1.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 ] = -1.000
 Average Recall     (AR) @[ IoU=0.50:0.95 | area= large | maxDets=100 ] = 0.000
[05/05 14:03:38] ppdet.engine INFO: Total sample number: 5, average FPS: 56.90092847336405
[05/05 14:03:38] ppdet.engine INFO: Best test bbox ap is 0.000.
[05/05 14:03:38] ppdet.utils.checkpoint INFO: Save checkpoint: output/picodet_lcnet_x1_0_layout_table
[05/05 14:03:38] ppdet.utils.checkpoint INFO: Save checkpoint: output/picodet_lcnet_x1_0_layout_table
[05/05 14:03:38] ppdet.engine INFO: Eval iter: 0
[05/05 14:03:38] 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/05 14:03:38] 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.01s).
Accumulating evaluation results...
DONE (t=0.00s).
 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 ] = -1.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 ] = -1.000
 Average Recall     (AR) @[ IoU=0.50:0.95 | area= large | maxDets=100 ] = 0.000
[05/05 14:03:38] ppdet.engine INFO: Total sample number: 5, average FPS: 55.79772727877419
[05/05 14:03:38] ppdet.engine INFO: Best test bbox ap is 0.000.
[05/05 14:03:38] ppdet.utils.checkpoint INFO: Save checkpoint: output/picodet_lcnet_x1_0_layout_table
[05/05 14:03:38] ppdet.utils.checkpoint INFO: Save checkpoint: output/picodet_lcnet_x1_0_layout_table
[05/05 14:03:38] ppdet.engine INFO: Eval iter: 0
[05/05 14:03:38] 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/05 14:03:38] 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.01s).
Accumulating evaluation results...
DONE (t=0.00s).
 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 ] = -1.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 ] = -1.000
 Average Recall     (AR) @[ IoU=0.50:0.95 | area= large | maxDets=100 ] = 0.000
[05/05 14:03:38] ppdet.engine INFO: Total sample number: 5, average FPS: 177.77747637010978
[05/05 14:03:38] ppdet.engine INFO: Best test bbox ap is 0.000.
[05/05 14:03:38] ppdet.utils.checkpoint INFO: Save checkpoint: output/picodet_lcnet_x1_0_layout_table
[05/05 14:03:38] ppdet.utils.checkpoint INFO: Save checkpoint: output/picodet_lcnet_x1_0_layout_table
[05/05 14:03:38] ppdet.engine INFO: Eval iter: 0
[05/05 14:03:38] 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/05 14:03:38] 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.01s).
Accumulating evaluation results...
DONE (t=0.00s).
 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 ] = -1.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 ] = -1.000
 Average Recall     (AR) @[ IoU=0.50:0.95 | area= large | maxDets=100 ] = 0.000
[05/05 14:03:38] ppdet.engine INFO: Total sample number: 5, average FPS: 251.1469049016203
[05/05 14:03:38] ppdet.engine INFO: Best test bbox ap is 0.000.
[05/05 14:03:38] ppdet.utils.checkpoint INFO: Save checkpoint: output/picodet_lcnet_x1_0_layout_table
[05/05 14:03:39] ppdet.utils.checkpoint INFO: Save checkpoint: output/picodet_lcnet_x1_0_layout_table
[05/05 14:03:39] ppdet.engine INFO: Eval iter: 0
[05/05 14:03:39] 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/05 14:03:39] 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.01s).
Accumulating evaluation results...
DONE (t=0.00s).
 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 ] = -1.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 ] = -1.000
 Average Recall     (AR) @[ IoU=0.50:0.95 | area= large | maxDets=100 ] = 0.000
[05/05 14:03:39] ppdet.engine INFO: Total sample number: 5, average FPS: 230.84946887555728
[05/05 14:03:39] ppdet.engine INFO: Best test bbox ap is 0.000.
[05/05 14:03:39] ppdet.utils.checkpoint INFO: Save checkpoint: output/picodet_lcnet_x1_0_layout_table

picodet_lcnet_x1_0_layout_table.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
weights: /home/DiskA/zncsPython/table_det/model/output/picodet_lcnet_x1_0_layout
find_unused_parameters: True
use_ema: true
cycle_epoch: 10
snapshot_epoch: 1
epoch: 100

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: 0
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

instance_train.json

{
    "images": [
        {
            "height": 613,
            "width": 1801,
            "id": 1,
            "file_name": "gdzcljzj_v1_4.png"
        },
        {
            "height": 648,
            "width": 1801,
            "id": 2,
            "file_name": "gdzcljzj_v1_5.png"
        },
        {
            "height": 683,
            "width": 1801,
            "id": 3,
            "file_name": "gdzcljzj_v1_3.png"
        },
        {
            "height": 683,
            "width": 1801,
            "id": 4,
            "file_name": "gdzcljzj_v1_2.png"
        },
        {
            "height": 683,
            "width": 1801,
            "id": 5,
            "file_name": "gdzcljzj_v1_1.png"
        }
    ],
    "categories": [
        {
            "supercategory": "component",
            "id": 1,
            "name": "table"
        }
    ],
    "annotations": [
        {
            "segmentation": [
                [
                    21.052631578947366,
                    97.52631578947364,
                    21.052631578947366,
                    484.8947368421052,
                    1783.157894736842,
                    484.8947368421052,
                    1783.157894736842,
                    97.52631578947364
                ]
            ],
            "iscrowd": 0,
            "image_id": 1,
            "bbox": [
                21.052631578947366,
                97.52631578947364,
                1762.1052631578948,
                387.36842105263156
            ],
            "area": 682583.9335180055,
            "category_id": 1,
            "id": 1
        },
        {
            "segmentation": [
                [
                    17.89473684210526,
                    101.84210526315786,
                    17.89473684210526,
                    521.8421052631578,
                    1783.157894736842,
                    521.8421052631578,
                    1783.157894736842,
                    101.84210526315786
                ]
            ],
            "iscrowd": 0,
            "image_id": 2,
            "bbox": [
                17.89473684210526,
                101.84210526315786,
                1765.2631578947369,
                419.99999999999994
            ],
            "area": 741410.5263157894,
            "category_id": 1,
            "id": 2
        },
        {
            "segmentation": [
                [
                    18.94736842105263,
                    99.8947368421052,
                    18.94736842105263,
                    556.7368421052631,
                    1782.1052631578946,
                    556.7368421052631,
                    1782.1052631578946,
                    99.8947368421052
                ]
            ],
            "iscrowd": 0,
            "image_id": 3,
            "bbox": [
                18.94736842105263,
                99.8947368421052,
                1763.1578947368419,
                456.8421052631579
            ],
            "area": 805484.7645429362,
            "category_id": 1,
            "id": 3
        },
        {
            "segmentation": [
                [
                    14.736842105263158,
                    97.78947368421052,
                    14.736842105263158,
                    555.6842105263157,
                    1784.2105263157894,
                    555.6842105263157,
                    1784.2105263157894,
                    97.78947368421052
                ]
            ],
            "iscrowd": 0,
            "image_id": 4,
            "bbox": [
                14.736842105263158,
                97.78947368421052,
                1769.4736842105262,
                457.8947368421052
            ],
            "area": 810232.6869806093,
            "category_id": 1,
            "id": 4
        },
        {
            "segmentation": [
                [
                    16.842105263157894,
                    96.73684210526312,
                    16.842105263157894,
                    557.7894736842104,
                    1783.157894736842,
                    557.7894736842104,
                    1783.157894736842,
                    96.73684210526312
                ]
            ],
            "iscrowd": 0,
            "image_id": 5,
            "bbox": [
                16.842105263157894,
                96.73684210526312,
                1766.3157894736842,
                461.0526315789473
            ],
            "area": 814364.5429362879,
            "category_id": 1,
            "id": 5
        }
    ]
}
nemonameless commented 1 year ago

训练集太小太小了,只有5张图吗,怎么指望能训出来。。而且fintune需要加载一个大规模数据集训好的权重做预训练 pretrain_weights: https://paddleocr.bj.bcebos.com/ppstructure/models/layout/picodet_lcnet_x1_0_layout.pdparams

rexzhengzhihong commented 1 year ago

训练集太小太小了,只有5张图吗,怎么指望能训出来。。而且fintune需要加载一个大规模数据集训好的权重做预训练 pretrain_weights: https://paddleocr.bj.bcebos.com/ppstructure/models/layout/picodet_lcnet_x1_0_layout.pdparams

感谢回复! pretrain_weights改了。训练集加到25张了。还是一样的结果,训练集是要多少张?

rexzhengzhihong commented 1 year ago

训练集太小太小了,只有5张图吗,怎么指望能训出来。。而且fintune需要加载一个大规模数据集训好的权重做预训练 pretrain_weights: https://paddleocr.bj.bcebos.com/ppstructure/models/layout/picodet_lcnet_x1_0_layout.pdparams

是我这边的问题,样本小于batch_size

hzhaoy commented 1 year ago

训练集太小太小了,只有5张图吗,怎么指望能训出来。。而且fintune需要加载一个大规模数据集训好的权重做预训练 pretrain_weights: https://paddleocr.bj.bcebos.com/ppstructure/models/layout/picodet_lcnet_x1_0_layout.pdparams

是我这边的问题,样本小于batch_size

@rexzhengzhihong 请问你是改了batch_size就解决问题了吗?还有其他操作吗