PaddleSeg icon indicating copy to clipboard operation
PaddleSeg copied to clipboard

[General Issue]train contrib/PanopticDeepLab时出现Logit和Label的shape不同报错

Open MorphlingX opened this issue 3 years ago • 3 comments

2022-08-10 02:33:20 [INFO]
------------Environment Information------------- platform: Windows-10-10.0.18362-SP0 Python: 3.8.9 (tags/v3.8.9:a743f81, Apr 6 2021, 14:02:34) [MSC v.1928 64 bit (AMD64)] Paddle compiled with cuda: True NVCC: Cuda compilation tools, release 10.2, V10.2.89 cudnn: 7.6 GPUs used: 1 CUDA_VISIBLE_DEVICES: None GPU: ['GPU 0: NVIDIA GeForce'] PaddleSeg: 2.6.0 PaddlePaddle: 2.3.1 OpenCV: 4.6.0

2022-08-10 02:33:22 [INFO]
---------------Config Information--------------- batch_size: 2 iters: 90000 learning_rate: decay: end_lr: 0.0 power: 0.9 type: poly value: 1.25e-05 loss: coef:

  • 1
  • 200
  • 0.001 types:
  • ignore_index: 255 top_k_percent_pixels: 0.2 type: CrossEntropyLoss
  • ignore_index: 255 reduction: none type: MSELoss
  • ignore_index: 255 reduction: none type: L1Loss model: align_corners: true aspp_out_channels: 256 aspp_ratios:
  • 1
  • 3
  • 6
  • 9 backbone: output_stride: 32 pretrained: https://bj.bcebos.com/paddleseg/dygraph/resnet50_vd_ssld_v2.tar.gz type: ResNet50_vd backbone_indices:
  • 2
  • 1
  • 0
  • 3 decoder_channels: 256 instance_aspp_out_channels: 256 instance_class_key:
  • center
  • offset instance_decoder_channels: 128 instance_head_channels: 32 instance_low_level_channels_projects:
  • 64
  • 32
  • 16 instance_num_classes:
  • 1
  • 2 low_level_channels_projects:
  • 128
  • 64
  • 32 type: PanopticDeepLab optimizer: type: adam train_dataset: dataset_root: data/cityscapes ignore_stuff_in_offset: true mode: train small_instance_area: 4096 small_instance_weight: 3 transforms:
  • max_scale_factor: 2.0 min_scale_factor: 0.5 scale_step_size: 0.25 type: ResizeStepScaling
  • crop_size:
    • 1025
    • 513 label_padding_value:
    • 0
    • 0
    • 0 type: RandomPaddingCrop
  • type: RandomHorizontalFlip
  • brightness_range: 0.4 contrast_range: 0.4 saturation_range: 0.4 type: RandomDistort
  • type: Normalize type: CityscapesPanoptic val_dataset: dataset_root: data/cityscapes ignore_stuff_in_offset: true mode: val small_instance_area: 4096 small_instance_weight: 3 transforms:
  • label_padding_value:
    • 0
    • 0
    • 0 target_size:
    • 2049
    • 1025 type: Padding
  • type: Normalize type: CityscapesPanoptic

W0810 02:33:24.015547 6100 gpu_resources.cc:61] Please NOTE: device: 0, GPU Compute Capability: 7.5, Driver API Version: 11.7, Runtime API Version: 10.2 W0810 02:33:24.015547 6100 gpu_resources.cc:91] device: 0, cuDNN Version: 7.6. 2022-08-10 02:33:24 [INFO] Loading pretrained model from https://bj.bcebos.com/paddleseg/dygraph/resnet50_vd_ssld_v2.tar.gz 2022-08-10 02:33:25 [INFO] There are 275/275 variables loaded into ResNet_vd. 2022-08-10 02:33:25 [WARNING] learning_rate in configuration file will be deprecated, please use lr_scheduler instead. E.g lr_scheduler: type: PolynomialDecay learning_rate: 0.01 C:\Users\LE\AppData\Local\Programs\Python\Python38\lib\site-packages\paddle\nn\layer\norm.py:653: UserWarning: When training, we now always track global mean and variance. warnings.warn( Traceback (most recent call last): File "train.py", line 177, in main(args) File "train.py", line 155, in main train( File "D:\PaddleSeg\contrib\PanopticDeepLab\core\train.py", line 174, in train loss_list = loss_computation( File "D:\PaddleSeg\contrib\PanopticDeepLab\core\train.py", line 39, in loss_computation semantic_loss = losses['types'][0](logits_list[0], semantic, File "C:\Users\LE\AppData\Local\Programs\Python\Python38\lib\site-packages\paddle\fluid\dygraph\layers.py", line 930, in call return self._dygraph_call_func(*inputs, **kwargs) File "C:\Users\LE\AppData\Local\Programs\Python\Python38\lib\site-packages\paddle\fluid\dygraph\layers.py", line 915, in _dygraph_call_func outputs = self.forward(*inputs, **kwargs) File "d:\paddleseg\paddleseg\models\losses\cross_entropy_loss.py", line 82, in forward loss = F.cross_entropy( File "C:\Users\LE\AppData\Local\Programs\Python\Python38\lib\site-packages\paddle\nn\functional\loss.py", line 1735, in cross_entropy _, out = _C_ops.softmax_with_cross_entropy( ValueError: (InvalidArgument) Input(Logits) and Input(Label) should in same shape in dimensions except axis. [Hint: Expected logits_dims[i] == labels_dims[i], but received logits_dims[i]:513 != labels_dims[i]:1024.] (at ..\paddle/fluid/operators/softmax_with_cross_entropy_op.cc:164)
[operator < softmax_with_cross_entropy > error]

Thanks for your issue. To help us solve the issue better, please provide following information:

  1. PaddleSeg version:2.6.0 (please specify the branch as well,e.g. PaddleSeg release/2.3)
  2. PaddlePaddle version: 2.3.1(e.g. PaddlePaddle 2.1.0)
  3. Operation system:Windows10 (e.g. Linux/Windows/MacOS)
  4. Python version: 3.8(e.g. Python3.6/7/8)
  5. CUDA/cuDNN version: CUDA10.2/cuDNN 7.6.5(e.g. CUDA10.2/cuDNN 7.6.5)
  6. Additional context: (Add any other context about the problem)

欢迎您反馈PaddleSeg使用问题,辛苦您提供以下信息,方便我们快速定位和解决问题:

  1. PaddleSeg版本:2.6.0(请提供版本号和分支信息,如PaddleSeg release/2.3)
  2. PaddlePaddle版本:2.3.1(如PaddlePaddle 2.1.0)
  3. 操作系统信息:Windows10(如Linux/Windows/MacOS)
  4. Python版本号:3.8(如Python3.6/7/8)
  5. CUDA/cuDNN版本:CUDA10.2/cuDNN7.6.5( 如CUDA10.2/cuDNN 7.6.5等)
  6. 其他内容: (增加其他与问题相关的内容)

MorphlingX avatar Aug 09 '22 18:08 MorphlingX

将PaddleSeg/contribPanopticDeepLab/datasets/cityscapes_panoptic.py中161行im, label = self.transforms(im=image_path, label=label_path)(运行时报错im参数不存在)改成了

tmp = self.transforms(dict(img=image_path, label=label_path))
im = tmp['img']
label = tmp['label']

可能导致了问题?

MorphlingX avatar Aug 09 '22 18:08 MorphlingX

新版本paddleseg的transform进行了升级,需要对应升级一下,后面会进行更新。

你可以先使用2.5版本。看看是否能正常运行

wuyefeilin avatar Aug 10 '22 03:08 wuyefeilin

新版本paddleseg的transform进行了升级,需要对应升级一下,后面会进行更新。

你可以先使用2.5版本。看看是否能正常运行

已经能够正常运行,单卡学习学习率需要改为1/4吗

MorphlingX avatar Aug 10 '22 05:08 MorphlingX

新版本已经修复该问题了。

学习率问题不一定需要修改,你可以做一下对比实验

wuyefeilin avatar Aug 16 '22 03:08 wuyefeilin