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.75k stars 2.88k forks source link

yoloV4运行错误 #863

Closed whjdark closed 4 years ago

whjdark commented 4 years ago

下最新的paddledetection,运行要求换2.0.0的paddle,换了2.0.0之后,它说必须要1.7.0及以上的paddle

willthefrog commented 4 years ago

请问你是怎么安装的paddle 2.0? 运行下面代码输出是啥?

import paddle
print(paddle.version.full_version)
Fitz-Fitz commented 4 years ago

请问你是怎么安装的paddle 2.0?运行下面的代码输出是啥?

进口 桨
打印(桨。版本。full_version)

!pip install paddlepaddle-gpu==2.0.0a0

willthefrog commented 4 years ago

请问你是怎么安装的paddle 2.0?运行下面的代码输出是啥?

进口 桨
打印(桨。版本。full_version)

???

jerrywgz commented 4 years ago

https://github.com/PaddlePaddle/PaddleDetection/pull/865 已修复~

whjdark commented 4 years ago

运行后!python -u tools/train.py -c configs/yolov4/yolov4_cspdarknet.yml \ --eval

Error: Input(X) and Input(Label) shall have the same shape except the last dimension. [Hint: Expected framework::slice_ddim(x_dims, 0, rank) == framework::slice_ddim(labels_dims, 0, rank), but received framework::slice_ddim(x_dims, 0, rank):12, 3, 40, 40 != framework::slice_ddim(labels_dims, 0, rank):12, 3, 10, 10.] at (/paddle/paddle/fluid/operators/sigmoid_cross_entropy_with_logits_op.cc:51) [operator < sigmoid_cross_entropy_with_logits > error]

训练数据没问题,RCNN可以跑。

请问你是怎么安装的paddle 2.0? 运行下面代码输出是啥?

import paddle
print(paddle.version.full_version)
jerrywgz commented 4 years ago

请问你使用的batch size是多少呢,在配置文件中需要将yolov3 loss中的batch size统一为你训练时使用的batch size

whjdark commented 4 years ago

请问你使用的batch size是多少呢,在配置文件中需要将yolov3 loss中的batch size统一为你训练时使用的batch size

这个设置应该是没问题的,我之前跑过VOC的yolov4,想试一下COCO的

YOLOv3Loss: batch_size: 12 ignore_thresh: 0.7 label_smooth: False downsample: [8,16,32]

scale_x_y: [1.2, 1.1, 1.05]

iou_loss: IouLoss match_score: true

YOLOv3_reader:

jerrywgz commented 4 years ago

发下的你完整配置文件吧

whjdark commented 4 years ago

发下的你完整配置文件吧

architecture: YOLOv4 use_gpu: true max_iters: 500200 log_smooth_window: 20 save_dir: output snapshot_iter: 2000 metric: COCO pretrain_weights: https://paddlemodels.bj.bcebos.com/object_detection/yolov4_cspdarknet.pdparams weights: output/yolov4_cspdarknet/best_model num_classes: 2 use_fine_grained_loss: True save_prediction_only: False

YOLOv4: backbone: CSPDarkNet yolo_head: YOLOv4Head

CSPDarkNet: norm_type: sync_bn norm_decay: 0. depth: 53

YOLOv4Head: anchors: [[12, 16], [19, 36], [40, 28], [36, 75], [76, 55], [72, 146], [142, 110], [192, 243], [459, 401]] anchor_masks: [[0, 1, 2], [3, 4, 5], [6, 7, 8]] nms: background_label: -1 keep_top_k: -1 nms_threshold: 0.45 nms_top_k: -1 normalized: true score_threshold: 0.001 downsample: [8,16,32]

YOLOv3Loss: batch_size: 12 ignore_thresh: 0.7 label_smooth: False downsample: [8,16,32]

scale_x_y: [1.2, 1.1, 1.05]

iou_loss: IouLoss match_score: true

IouLoss: loss_weight: 0.07 max_height: 608 max_width: 608 ciou_term: true loss_square: true

LearningRate: base_lr: 0.0001 schedulers:

OptimizerBuilder: clip_grad_by_norm: 10. optimizer: momentum: 0.949 type: Momentum regularizer: factor: 0.0005 type: L2

READER: '../yolov3_reader.yml'

EvalReader: inputs_def: fields: ['image', 'im_size', 'im_id'] num_max_boxes: 50 dataset: !COCODataSet image_dir: images anno_path: annotations/val2017.json dataset_dir: ../data/coco with_background: false sample_transforms:

TestReader: dataset: !ImageFolder anno_path: annotations/val2017.json dataset_dir: ../data/coco use_default_label: False with_background: false sample_transforms:

YOLOv3_reader:

TrainReader: inputs_def: fields: ['image', 'gt_bbox', 'gt_class', 'gt_score'] num_max_boxes: 50 dataset: !COCODataSet image_dir: images anno_path: annotations/train2017.json dataset_dir: ../data/coco with_background: false sample_transforms:

EvalReader: inputs_def: fields: ['image', 'im_size', 'im_id'] num_max_boxes: 50 dataset: !COCODataSet image_dir: val2017 anno_path: annotations/instances_val2017.json dataset_dir: dataset/coco with_background: false sample_transforms:

TestReader: inputs_def: image_shape: [3, 608, 608] fields: ['image', 'im_size', 'im_id'] dataset: !ImageFolder anno_path: annotations/instances_val2017.json with_background: false sample_transforms:

jerrywgz commented 4 years ago

https://github.com/PaddlePaddle/PaddleDetection/blob/release/0.3/configs/yolov4/yolov4_cspdarknet_voc.yml#L115 在trainreader中gt2yolotarget里的anchor设置和yolov3中是不同的,这里需要注意下,你应该是只修改了head的部分没有改reader