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.82k stars 2.89k forks source link

pp-yolo训练自定义数据集出现tensor is not initialized错误 #1325

Closed muzinicemoon closed 4 years ago

muzinicemoon commented 4 years ago

python -u tools/train.py -c configs/ppyolo/ppyolo.yml --eval 报错信息如下:

2020-08-31 17:17:48,609-INFO: If regularizer of a Parameter has been set by 'fluid.ParamAttr' or 'fluid.WeightNormParamAttr' already. The Regularization[L2Decay, regularization_coeff=0.000500] in Optimizer will not take effect, and it will only be applied to other
 Parameters!
2020-08-31 17:17:59,541-INFO: places would be ommited when DataLoader is not iterable
W0831 17:17:59.633438   872 device_context.cc:252] Please NOTE: device: 0, CUDA Capability: 52, Driver API Version: 11.0, Runtime API Version: 10.0
W0831 17:17:59.649430   872 device_context.cc:260] device: 0, cuDNN Version: 7.6.
2020-08-31 17:18:01,831-WARNING: D:\ResNet50_vd_ssld_pretrained.pdparams not found, try to load model file saved with [ save_params, save_persistables, save_vars ]
D:\anaconda2\envs\py3\lib\site-packages\paddle\fluid\io.py:1998: UserWarning: This list is not set, Because of Paramerter not found in program. There are: fc_0.b_0 fc_0.w_0
  format(" ".join(unused_para_list)))
2020-08-31 17:18:05,968-INFO: places would be ommited when DataLoader is not iterable
W0831 17:18:06.056457   872 build_strategy.cc:170] fusion_group is not enabled for Windows/MacOS now, and only effective when running with CUDA GPU.
D:\anaconda2\envs\py3\lib\site-packages\paddle\fluid\executor.py:1070: UserWarning: The following exception is not an EOF exception.
  "The following exception is not an EOF exception.")
Traceback (most recent call last):
  File "tools/train.py", line 370, in <module>
    main()
  File "tools/train.py", line 243, in main
    outs = exe.run(compiled_train_prog, fetch_list=train_values)
  File "D:\anaconda2\envs\py3\lib\site-packages\paddle\fluid\executor.py", line 1071, in run
    six.reraise(*sys.exc_info())
  File "D:\anaconda2\envs\py3\lib\site-packages\six.py", line 703, in reraise
    raise value
  File "D:\anaconda2\envs\py3\lib\site-packages\paddle\fluid\executor.py", line 1066, in run
    return_merged=return_merged)
  File "D:\anaconda2\envs\py3\lib\site-packages\paddle\fluid\executor.py", line 1167, in _run_impl
    return_merged=return_merged)
  File "D:\anaconda2\envs\py3\lib\site-packages\paddle\fluid\executor.py", line 879, in _run_parallel
    tensors = exe.run(fetch_var_names, return_merged)._move_to_list()
paddle.fluid.core_avx.EnforceNotMet:

--------------------------------------------
C++ Call Stacks (More useful to developers):
--------------------------------------------
Windows not support stack backtrace yet.

------------------------------------------
Python Call Stacks (More useful to users):
------------------------------------------
  File "D:\anaconda2\envs\py3\lib\site-packages\paddle\fluid\framework.py", line 2610, in append_op
    attrs=kwargs.get("attrs", None))
  File "D:\anaconda2\envs\py3\lib\site-packages\paddle\fluid\layer_helper.py", line 43, in append_op
    return self.main_program.current_block().append_op(*args, **kwargs)
  File "D:\anaconda2\envs\py3\lib\site-packages\paddle\fluid\layers\nn.py", line 9949, in crop
    attrs=None if len(attrs) == 0 else attrs)
  File "D:\2020-projects\PaddleDetection\ppdet\modeling\losses\iou_loss.py", line 207, in _bbox_transform
    anchor_h = fluid.layers.crop(x=anchor_h_max, shape=dcx)
  File "D:\2020-projects\PaddleDetection\ppdet\modeling\losses\iou_aware_loss.py", line 73, in __call__
    batch_size, True, scale_x_y, eps)
  File "D:\2020-projects\PaddleDetection\ppdet\modeling\losses\yolo_loss.py", line 183, in _get_fine_grained_loss
    self._batch_size, scale_x_y)
  File "D:\2020-projects\PaddleDetection\ppdet\modeling\losses\yolo_loss.py", line 69, in __call__
    mask_anchors, self._ignore_thresh)
  File "D:\2020-projects\PaddleDetection\ppdet\modeling\anchor_heads\yolo_head.py", line 394, in get_loss
    self.prefix_name)
  File "D:\2020-projects\PaddleDetection\ppdet\modeling\architectures\yolo.py", line 85, in build
    gt_score, targets)
  File "D:\2020-projects\PaddleDetection\ppdet\modeling\architectures\yolo.py", line 159, in train
    return self.build(feed_vars, mode='train')
  File "tools/train.py", line 116, in main
    train_fetches = model.train(feed_vars)
  File "tools/train.py", line 370, in <module>
    main()

----------------------
Error Message Summary:
----------------------
InvalidArgumentError: The Tensor in the crop Op's Input Variable X(create_parameter_47.w_0) is not initialized.
  [Hint: Expected t->IsInitialized() == true, but received t->IsInitialized():0 != true:1.] at (D:\1.8.4\paddle\paddle\fluid\framework\operator.cc:1289)
  [operator < crop > error]
`
附上ppyolo_reader.yml代码

`TrainReader:
  inputs_def:
    fields: ['image', 'gt_bbox', 'gt_class', 'gt_score']
    num_max_boxes: 50
  dataset:
    !VOCDataSet
      anno_path: trainval.txt
      dataset_dir: dataset/dust
      use_default_label: false
      with_background: false
  sample_transforms:
    - !DecodeImage
      to_rgb: True
      with_mixup: True
    - !MixupImage
      alpha: 1.5
      beta: 1.5
    - !ColorDistort {}
    - !RandomExpand
      fill_value: [123.675, 116.28, 103.53]
    - !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
    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: 2
  shuffle: true
  mixup_epoch: 150
  drop_last: true
  worker_num: 1
  bufsize: 4
  use_process: true

EvalReader:
  inputs_def:
    fields: ['image', 'im_size', 'im_id']
    num_max_boxes: 50
  dataset:
    !VOCDataSet
      dataset_dir: dataset/dust
      anno_path: test.txt
      use_default_label: false
      with_background: false
  sample_transforms:
    - !DecodeImage
      to_rgb: True
    - !ResizeImage
      target_size: 608
      interp: 2
    - !NormalizeImage
      mean: [0.485, 0.456, 0.406]
      std: [0.229, 0.224, 0.225]
      is_scale: True
      is_channel_first: false
    - !PadBox
      num_max_boxes: 50
    - !Permute
      to_bgr: false
      channel_first: True
  batch_size: 2
  drop_empty: false
  worker_num: 1
  bufsize: 4
qingqing01 commented 4 years ago

@muzinicemoon 和 https://github.com/PaddlePaddle/PaddleDetection/issues/1272 相同,已修复了 https://github.com/PaddlePaddle/PaddleDetection/pull/1275 ,你可以更新下代码,到最新分支。

muzinicemoon commented 4 years ago

@muzinicemoon 和 #1272 相同,已修复了 #1275 ,你可以更新下代码,到最新分支。

感谢,已解决