MiniBullLab / easy_ai

3 stars 1 forks source link

运行segnet报错 #148

Closed foww-0001 closed 3 years ago

foww-0001 commented 3 years ago

通过easy_tools运行segnet报错:

./easy_tools/train_scripts/SegNet.sh /home/edge/data/VOCdevkit/car_scratch_segment/ImageSets/train.txt /home/edge/data/VOCdevkit/car_scratch_segment/ImageSets/val.txt

报错如下:

2021-09-09 18:12:59,789 ERROR   [train_task.py, 42] Traceback (most recent call last):
  File "/home/edge/workspace/EDGE/easy_ai/easyai/train_task.py", line 39, in train
    task.train(self.train_path, self.val_path)
  File "/home/edge/workspace/EDGE/easy_ai/easyai/tasks/seg/segment_train.py", line 31, in train
    self.train_epoch(epoch, self.lr_scheduler, self.dataloader)
  File "/home/edge/workspace/EDGE/easy_ai/easyai/tasks/seg/segment_train.py", line 41, in train_epoch
    loss_info = self.compute_backward(batch_data, temp_index)
  File "/home/edge/workspace/EDGE/easy_ai/easyai/tasks/seg/segment_train.py", line 48, in compute_backward
    loss, loss_info = self.compute_loss(output_list, batch_data)
  File "/home/edge/workspace/EDGE/easy_ai/easyai/tasks/seg/segment_train.py", line 69, in compute_loss
    loss = self.model.lossList[0](output, batch_data)
  File "/home/edge/workspace/EDGE/EasyAIENV/lib/python3.6/site-packages/torch/nn/modules/module.py", line 889, in _call_impl
    result = self.forward(*input, **kwargs)
  File "/home/edge/workspace/EDGE/easy_ai/easyai/loss/cls/ce2d_loss.py", line 118, in forward
    reduction='none')
  File "/home/edge/workspace/EDGE/EasyAIENV/lib/python3.6/site-packages/torch/nn/functional.py", line 2752, in binary_cross_entropy
    "Please ensure they have the same size.".format(target.size(), input.size())
ValueError: Using a target size (torch.Size([1, 448, 512])) that is different to the input size (torch.Size([1, 1, 448, 512])) is deprecated. Please ensure they have the same size.
foww-0001 commented 3 years ago

以解决。