请提供下述完整信息以便快速定位问题/Please provide the following information to quickly locate the problem
- 系统环境/System Environment:docker ubuntu 20.04,是官方提供的镜像
- 版本号/Version:Paddle:2.5.1, PaddleOCR:release/2.7 或者 dygraph
- 问题相关组件/Related components:train.py
- 运行指令/Command Code:
python tools/train.py -c configs/rec/PP-OCRv4/ch_PP-OCRv4_rec_distill.yml
- 完整报错/Complete Error Message:
Traceback (most recent call last):
File "/workspace3/xlg/paddle-ocr/tools/train.py", line 227, in
main(config, device, logger, vdl_writer)
File "/workspace3/xlg/paddle-ocr/tools/train.py", line 135, in main
model = build_model(config['Architecture'])
File "/workspace3/xlg/paddle-ocr/ppocr/modeling/architectures/init.py", line 34, in build_model
arch = getattr(mod, name)(config)
File "/workspace3/xlg/paddle-ocr/ppocr/modeling/architectures/distillation_model.py", line 47, in init
model = BaseModel(model_config)
File "/workspace3/xlg/paddle-ocr/ppocr/modeling/architectures/base_model.py", line 76, in init
self.head = build_head(config["Head"])
File "/workspace3/xlg/paddle-ocr/ppocr/modeling/heads/init.py", line 71, in build_head
module_class = eval(module_name)(**config)
File "/workspace3/xlg/paddle-ocr/ppocr/modeling/heads/rec_multi_head.py", line 74, in init
out_channels=out_channels_list['NRTRLabelDecode'])
KeyError: 'NRTRLabelDecode'
LAUNCH INFO 2023-08-22 13:38:33,426 Exit code -9
[2023-08-22 13:38:33,426] [ INFO] controller.py:149 - Exit code -9
-
应该是以下代码出了问题:
-
还有yml文件这里,也漏了imageshape,否则会报错 KeyError: 'valid_ratio':
-
但是最后还是报错了:
ValueError: (InvalidArgument) The input of Op(Conv) should be a 4-D or 5-D Tensor. But received: input's dimension is 3, input's shape is [128, 240, 256].
[2023-08-22 15:14:38,216] [ INFO] controller.py:117 - ------------------------- ERROR LOG DETAIL -------------------------
ls/train.py", line 227, in
main(config, device, logger, vdl_writer)
File "/workspace3/xlg/paddle-ocr/tools/train.py", line 198, in main
program.train(config, train_dataloader, valid_dataloader, device, model,
File "/workspace3/xlg/paddle-ocr/tools/program.py", line 301, in train
preds = model(images, data=batch[1:])
File "/usr/local/lib/python3.10/dist-packages/paddle/nn/layer/layers.py", line 1254, in call
return self.forward(*inputs, kwargs)
File "/usr/local/lib/python3.10/dist-packages/paddle/distributed/parallel.py", line 531, in forward
outputs = self._layers(*inputs, *kwargs)
File "/usr/local/lib/python3.10/dist-packages/paddle/nn/layer/layers.py", line 1254, in call
return self.forward(inputs, kwargs)
File "/workspace3/xlg/paddle-ocr/ppocr/modeling/architectures/distillation_model.py", line 59, in forward
result_dict[model_name] = self.model_list[idx](x, data)
File "/usr/local/lib/python3.10/dist-packages/paddle/nn/layer/layers.py", line 1254, in call
return self.forward(*inputs, kwargs)
File "/workspace3/xlg/paddle-ocr/ppocr/modeling/architectures/base_model.py", line 100, in forward
x = self.head(x, targets=data)
File "/usr/local/lib/python3.10/dist-packages/paddle/nn/layer/layers.py", line 1254, in call
return self.forward(*inputs, *kwargs)
File "/workspace3/xlg/paddle-ocr/ppocr/modeling/heads/rec_multi_head.py", line 92, in forward
ctc_encoder = self.ctc_encoder(x)
File "/usr/local/lib/python3.10/dist-packages/paddle/nn/layer/layers.py", line 1254, in call
return self.forward(inputs, kwargs)
File "/workspace3/xlg/paddle-ocr/ppocr/modeling/necks/rnn.py", line 261, in forward
x = self.encoder(x)
File "/usr/local/lib/python3.10/dist-packages/paddle/nn/layer/layers.py", line 1254, in call
return self.forward(*inputs, kwargs)
File "/workspace3/xlg/paddle-ocr/ppocr/modeling/necks/rnn.py", line 208, in forward
z = self.conv1(z)
File "/usr/local/lib/python3.10/dist-packages/paddle/nn/layer/layers.py", line 1254, in call
return self.forward(*inputs, *kwargs)
File "/workspace3/xlg/paddle-ocr/ppocr/modeling/backbones/rec_svtrnet.py", line 68, in forward
out = self.conv(inputs)
File "/usr/local/lib/python3.10/dist-packages/paddle/nn/layer/layers.py", line 1254, in call
return self.forward(inputs, kwargs)
File "/usr/local/lib/python3.10/dist-packages/paddle/nn/layer/conv.py", line 710, in forward
out = F.conv._conv_nd(
File "/usr/local/lib/python3.10/dist-packages/paddle/nn/functional/conv.py", line 133, in _conv_nd
pre_bias = _C_ops.conv2d(
ValueError: (InvalidArgument) The input of Op(Conv) should be a 4-D or 5-D Tensor. But received: input's dimension is 3, input's shape is [128, 240, 256].
[Hint: Expected in_dims.size() == 4 || in_dims.size() == 5 == true, but received in_dims.size() == 4 || in_dims.size() == 5:0 != true:1.] (at ../paddle/phi/infermeta/binary.cc:468)