Skip to content

  • 体验新版
    • 正在加载...
  • 登录
  • PaddlePaddle
  • PaddleDetection
  • Issue
  • #919

P
PaddleDetection
  • 项目概览

PaddlePaddle / PaddleDetection
大约 2 年 前同步成功

通知 708
Star 11112
Fork 2696
  • 代码
    • 文件
    • 提交
    • 分支
    • Tags
    • 贡献者
    • 分支图
    • Diff
  • Issue 184
    • 列表
    • 看板
    • 标记
    • 里程碑
  • 合并请求 40
  • Wiki 0
    • Wiki
  • 分析
    • 仓库
    • DevOps
  • 项目成员
  • Pages
P
PaddleDetection
  • 项目概览
    • 项目概览
    • 详情
    • 发布
  • 仓库
    • 仓库
    • 文件
    • 提交
    • 分支
    • 标签
    • 贡献者
    • 分支图
    • 比较
  • Issue 184
    • Issue 184
    • 列表
    • 看板
    • 标记
    • 里程碑
  • 合并请求 40
    • 合并请求 40
  • Pages
  • 分析
    • 分析
    • 仓库分析
    • DevOps
  • Wiki 0
    • Wiki
  • 成员
    • 成员
  • 收起侧边栏
  • 动态
  • 分支图
  • 创建新Issue
  • 提交
  • Issue看板
已关闭
开放中
Opened 6月 10, 2020 by saxon_zh@saxon_zhGuest

报错Dims of all Inputs(X) must be the same, but received input 2 dim is:-1, 2, -1, -1 not equal to input 0 dim:-1, 3, -1, -1.

Created by: LongLivecn

我用自己制作的coco格式的数据集在给的yolov3-darknet.yml配置文件上跑通了,但是精度太低,后来我又放到dcn/yolov3_r50vd_dcn_obj365_pretrained_coco.yml这个配置文件上训练,结果报错。 报错信息:

Error Message Summary:

InvalidArgumentError: Dims of all Inputs(X) must be the same, but received input 2 dim is:-1, 2, -1, -1 not equal to input 0 dim:-1, 3, -1, -1. [Hint: Expected input_dims[i] == input_dims[0], but received input_dims[i]:-1, 2, -1, -1 != input_dims[0]:-1, 3, -1, -1.] at (/paddle/paddle/fluid/operators/stack_op.cc:46) [operator < stack > error] 请大佬指教

完整报错信息:

aistudio@jupyter-213340-537112:~/PaddleDetection$ python -u tools/train.py -c configs/dcn/yolov3_r50vd_dcn_obj365_pretrained_coco.yml --eval warning: cornerpool_lib not found, compile in ext_op at first if needed Traceback (most recent call last): File "tools/train.py", line 376, in main() File "tools/train.py", line 123, in main train_fetches = model.train(feed_vars) File "/home/aistudio/PaddleDetection/ppdet/modeling/architectures/yolov3.py", line 156, in train return self.build(feed_vars, mode='train') File "/home/aistudio/PaddleDetection/ppdet/modeling/architectures/yolov3.py", line 85, in build gt_score, targets) File "/home/aistudio/PaddleDetection/ppdet/modeling/anchor_heads/yolo_head.py", line 285, in get_loss self.prefix_name) File "/home/aistudio/PaddleDetection/ppdet/modeling/losses/yolo_loss.py", line 59, in call mask_anchors, self._ignore_thresh) File "/home/aistudio/PaddleDetection/ppdet/modeling/losses/yolo_loss.py", line 122, in _get_fine_grained_loss num_classes) File "/home/aistudio/PaddleDetection/ppdet/modeling/losses/yolo_loss.py", line 240, in _split_output clss, axis=1), perm=[0, 1, 3, 4, 2]) File "/opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/paddle/fluid/layers/nn.py", line 9164, in stack attrs={'axis': axis}) File "/opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/paddle/fluid/layer_helper.py", line 43, in append_op return self.main_program.current_block().append_op(*args, **kwargs) File "/opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/paddle/fluid/framework.py", line 2525, in append_op attrs=kwargs.get("attrs", None)) File "/opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/paddle/fluid/framework.py", line 1880, in init self.desc.infer_shape(self.block.desc) paddle.fluid.core_avx.EnforceNotMet:


C++ Call Stacks (More useful to developers):

0 std::string paddle::platform::GetTraceBackString<std::string const&>(std::string const&, char const*, int) 1 paddle::platform::EnforceNotMet::EnforceNotMet(std::string const&, char const*, int) 2 paddle::operators::StackOp::InferShape(paddle::framework::InferShapeContext*) const 3 paddle::framework::OpDesc::InferShape(paddle::framework::BlockDesc const&) const


Python Call Stacks (More useful to users):

File "/opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/paddle/fluid/framework.py", line 2525, in append_op attrs=kwargs.get("attrs", None)) File "/opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/paddle/fluid/layer_helper.py", line 43, in append_op return self.main_program.current_block().append_op(*args, **kwargs) File "/opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/paddle/fluid/layers/nn.py", line 9164, in stack attrs={'axis': axis}) File "/home/aistudio/PaddleDetection/ppdet/modeling/losses/yolo_loss.py", line 240, in _split_output clss, axis=1), perm=[0, 1, 3, 4, 2]) File "/home/aistudio/PaddleDetection/ppdet/modeling/losses/yolo_loss.py", line 122, in _get_fine_grained_loss num_classes) File "/home/aistudio/PaddleDetection/ppdet/modeling/losses/yolo_loss.py", line 59, in call mask_anchors, self._ignore_thresh) File "/home/aistudio/PaddleDetection/ppdet/modeling/anchor_heads/yolo_head.py", line 285, in get_loss self.prefix_name) File "/home/aistudio/PaddleDetection/ppdet/modeling/architectures/yolov3.py", line 85, in build gt_score, targets) File "/home/aistudio/PaddleDetection/ppdet/modeling/architectures/yolov3.py", line 156, in train return self.build(feed_vars, mode='train') File "tools/train.py", line 123, in main train_fetches = model.train(feed_vars) File "tools/train.py", line 376, in main()


Error Message Summary:

InvalidArgumentError: Dims of all Inputs(X) must be the same, but received input 2 dim is:-1, 2, -1, -1 not equal to input 0 dim:-1, 3, -1, -1. [Hint: Expected input_dims[i] == input_dims[0], but received input_dims[i]:-1, 2, -1, -1 != input_dims[0]:-1, 3, -1, -1.] at (/paddle/paddle/fluid/operators/stack_op.cc:46) [operator < stack > error]

配置文件: architecture: YOLOv3 use_gpu: true max_iters: 20000 log_smooth_window: 20 save_dir: output snapshot_iter: 500 metric: COCO pretrain_weights: https://paddlemodels.bj.bcebos.com/object_detection/ResNet50_vd_dcn_db_obj365_pretrained.tar weights: output/yolov3_r50vd_dcn_db_obj365_pretrained_coco/model_final num_classes: 3 use_fine_grained_loss: true

YOLOv3: backbone: ResNet yolo_head: YOLOv3Head use_fine_grained_loss: true

ResNet: norm_type: sync_bn freeze_at: 0 freeze_norm: false norm_decay: 0. depth: 50 feature_maps: [3, 4, 5] variant: d dcn_v2_stages: [5]

YOLOv3Head: anchor_masks: [[6, 7, 8], [3, 4, 5], [0, 1, 2]] anchors: [[10, 13], [16, 30], [33, 23], [30, 61], [62, 45], [59, 119], [116, 90], [156, 198], [373, 326]] norm_decay: 0. yolo_loss: YOLOv3Loss nms: background_label: -1 keep_top_k: 100 nms_threshold: 0.45 nms_top_k: 1000 normalized: false score_threshold: 0.01

YOLOv3Loss:

batch_size here is only used for fine grained loss, not used

for training batch_size setting, training batch_size setting

is in configs/yolov3_reader.yml TrainReader.batch_size, batch

size here should be set as same value as TrainReader.batch_size

batch_size: 8 ignore_thresh: 0.7 label_smooth: true use_fine_grained_loss: true

LearningRate: base_lr: 0.001 schedulers:

  • !PiecewiseDecay gamma: 0.1 milestones:
    • 5000
    • 10000
    • 15000
  • !LinearWarmup start_factor: 0. steps: 400

OptimizerBuilder: optimizer: momentum: 0.9 type: Momentum regularizer: factor: 0.0005 type: L2

READER: 'yolov3_enhance_reader.yml'

TrainReader: inputs_def: fields: ['image', 'gt_bbox', 'gt_class', 'gt_score'] num_max_boxes: 50 use_fine_grained_loss: false #true dataset: !COCODataSet image_dir: train anno_path: annotations/instances_train.json dataset_dir: dataset/coco2020 with_background: false sample_transforms: - !DecodeImage to_rgb: True - !RandomCrop {} - !RandomFlipImage is_normalized: false - !NormalizeBox {} - !PadBox num_max_boxes: 50 - !BboxXYXY2XYWH {} batch_transforms: - !RandomShape sizes: [320, 352, 384, 416, 448, 480, 512, 544, 576, 608] random_inter: True - !NormalizeImage mean: [0.485, 0.456, 0.406] std: [0.229, 0.224, 0.225] is_scale: True #False is_channel_first: false - !Permute to_bgr: false channel_first: True # Gt2YoloTarget is only used when use_fine_grained_loss set as true, # this operator will be deleted automatically if use_fine_grained_loss # is set as false - !Gt2YoloTarget anchor_masks: [[6, 7, 8], [3, 4, 5], [0, 1, 2]] anchors: [[10, 13], [16, 30], [33, 23], [30, 61], [62, 45], [59, 119], [116, 90], [156, 198], [373, 326]] downsample_ratios: [32, 16, 8] batch_size: 4 shuffle: true drop_last: true worker_num: 2 bufsize: 16 use_process: true

EvalReader: inputs_def: image_shape: [3, 608, 608] fields: ['image', 'im_size', 'im_id'] num_max_boxes: 50 dataset: !COCODataSet dataset_dir: dataset/coco2020 anno_path: annotations/instances_val.json image_dir: val with_background: false sample_transforms: - !DecodeImage to_rgb: True with_mixup: false - !ResizeImage interp: 2 target_size: 608 - !NormalizeImage mean: [0.485, 0.456, 0.406] std: [0.229, 0.224, 0.225] is_scale: True #False is_channel_first: false - !PadBox num_max_boxes: 50 - !Permute to_bgr: false channel_first: True batch_size: 4 drop_empty: false worker_num: 2 bufsize: 16

TestReader: inputs_def: image_shape: [3, 608, 608] fields: ['image', 'im_size', 'im_id'] dataset: !ImageFolder dataset_dir: dataset/coco2020 anno_path: annotations/instances_val.json with_background: false sample_transforms: - !DecodeImage to_rgb: True with_mixup: false - !ResizeImage interp: 2 target_size: 608 - !NormalizeImage mean: [0.485, 0.456, 0.406] std: [0.229, 0.224, 0.225] is_scale: True #False is_channel_first: false - !Permute to_bgr: false channel_first: True batch_size: 1

指派人
分配到
无
里程碑
无
分配里程碑
工时统计
无
截止日期
无
标识: paddlepaddle/PaddleDetection#919
渝ICP备2023009037号

京公网安备11010502055752号

网络110报警服务 Powered by GitLab CE v13.7
开源知识
Git 入门 Pro Git 电子书 在线学 Git
Markdown 基础入门 IT 技术知识开源图谱
帮助
使用手册 反馈建议 博客
《GitCode 隐私声明》 《GitCode 服务条款》 关于GitCode
Powered by GitLab CE v13.7