PaddleSeg
PaddleSeg copied to clipboard
黑白图片训练和推理,yml文件如何配置
问题确认 Search before asking
- [x] 我已经搜索过问题,但是没有找到解答。I have searched the question and found no related answer.
请提出你的问题 Please ask your question
如下是我的yml配置文档,使用PPLiteSeg模型设置img_chnnels:1可以正常训练,但用tools/predict.py 推理图片会报错 ValueError: (InvalidArgument) The number of input's channels should be equal to filter's channels * groups for Op(Conv). But received: the input's channels is 3, the input's shape is [1, 3, 1200, 800]; the filter's channels is 1, the filter's shape is [32, 1, 3, 3]; the groups is 1, the data_format is NCHW. The error may come from wrong data_format setting. [Hint: Expected input_channels == filter_channels * groups, but received input_channels:3 != filter_channels * groups:1.] (at ..\paddle\phi\infermeta\binary.cc:645)
yml文件内容如下: batch_size: 12 iters: 90000 train_dataset: type: Dataset img_channels: 1 dataset_root: C:/Users/yx/PaddleSeg/data/Trains/113226 num_classes: 12 mode: train train_path: C:/Users/yx/PaddleSeg/data/Trains/113226/train.txt transforms: - type: ResizeStepScaling min_scale_factor: 0.5 max_scale_factor: 2.5 scale_step_size: 0.25 - type: RandomPaddingCrop crop_size: [512, 512] - type: RandomHorizontalFlip - type: RandomDistort brightness_range: 0.5 contrast_range: 0.5 saturation_range: 0.5 - type: Normalize val_dataset: type: Dataset img_channels: 1 dataset_root: C:/Users/yx/PaddleSeg/data/Trains/113226 num_classes: 12 mode: val val_path: C:/Users/yx/PaddleSeg/data/Trains/113226/val.txt transforms: - type: Normalize optimizer: type: SGD momentum: 0.9 weight_decay: 5.0e-4 lr_scheduler: type: PolynomialDecay learning_rate: 0.005 end_lr: 0 power: 0.9 warmup_iters: 200 warmup_start_lr: 1.0e-5 loss: types: - type: OhemCrossEntropyLoss min_kept: 250000 # batch_size * 960 * 720 // 16 - type: OhemCrossEntropyLoss min_kept: 250000 - type: OhemCrossEntropyLoss min_kept: 250000 coef: [1, 1, 1] model: type: PPLiteSeg backbone: type: STDC1 in_channels: 1 pretrained: https://bj.bcebos.com/paddleseg/dygraph/PP_STDCNet1.tar.gz arm_out_chs: [32, 64, 128] seg_head_inter_chs: [32, 64, 64] num_classes: 12 # 修改为你的类别数