PaddleSeg icon indicating copy to clipboard operation
PaddleSeg copied to clipboard

自定义数据集出现 TypeError: Config.__init__() got an unexpected keyword argument 'to_static_training'

Open lai-serena opened this issue 1 year ago • 4 comments

问题确认 Search before asking

  • [X] 我已经搜索过问题,但是没有找到解答。I have searched the question and found no related answer.

请提出你的问题 Please ask your question

TypeError: Config.init() got an unexpected keyword argument 'to_static_training' image

自定义数据集按照官方要求整理 image

配置文件如下: train_dataset: #训练数据设置 type: Dataset #指定加载数据集的类。数据集类的代码在PaddleSeg/paddleseg/datasets`目录下。 dataset_root: water_ponding_dataset #数据集路径 train_path: water_ponding_dataset/train.txt #数据集中用于训练的标识文件 num_classes: 2 #指定类别个数(背景也算为一类) mode: train #表示用于训练 transforms: #模型训练的数据预处理方式。 - type: ResizeStepScaling #将原始图像和标注图像随机缩放为0.5~2.0倍 min_scale_factor: 0.5 max_scale_factor: 2.0 scale_step_size: 0.25 - type: RandomPaddingCrop #从原始图像和标注图像中随机裁剪512x512大小 crop_size: [1024, 512] - type: RandomHorizontalFlip #对原始图像和标注图像随机进行水平反转 - type: RandomDistort #对原始图像进行亮度、对比度、饱和度随机变动,标注图像不变 brightness_range: 0.4 contrast_range: 0.4 saturation_range: 0.4 - type: Normalize #对原始图像进行归一化,标注图像保持不变

val_dataset: #验证数据设置 type: Dataset #指定加载数据集的类。数据集类的代码在PaddleSeg/paddleseg/datasets目录下。 dataset_root: water_ponding_dataset #数据集路径 val_path: water_ponding_dataset/val.txt #数据集中用于验证的标识文件 num_classes: 2 #指定类别个数(背景也算为一类) mode: val #表示用于验证 transforms: #模型验证的数据预处理的方式 - type: Normalize #对原始图像进行归一化,标注图像保持不变

batch_size: 2 #设定batch_size的值即为迭代一次送入网络的图片数量,一般显卡显存越大,batch_size的值可以越大。如果使用多卡训练,总得batch size等于该batch size乘以卡数。 iters: 160000 #模型训练迭代的轮数

model: type: OCRNet backbone: type: HRNet_W18 pretrained: https://bj.bcebos.com/paddleseg/dygraph/hrnet_w18_ssld.tar.gz backbone_indices: [0]

optimizer: type: SGD momentum: 0.9 #设置SGD的动量 weight_decay: 4.0e-5 #权值衰减,使用的目的是防止过拟合

lr_scheduler: type: PolynomialDecay learning_rate: 0.00125 power: 0.9

loss: types: - type: MixedLoss losses: - type: CrossEntropyLoss - type: LovaszSoftmaxLoss coef: [0.8, 0.2] - type: MixedLoss losses: - type: CrossEntropyLoss - type: LovaszSoftmaxLoss coef: [0.8, 0.2] coef: [1, 0.4] 训练命令行如下: export CUDA_VISIBLE_DEVICES=0,1,2 python -m paddle.distributed.launch tools/train.py
--config configs/ocrnet/ocrnet_hrnetw18_water_1024x512_160k_lovasz_softmax.yml
--do_eval
--use_vdl
--save_interval 500
--save_dir output` 运行环境: paddlepaddle-gpu 2.6.0.post112 paddleseg 2.8.0 linux系统

lai-serena avatar Jan 04 '24 08:01 lai-serena

The commit version about 3 weeks age is ok! Or you can comment the related codes about static_trainint.

changwsh12 avatar Jan 08 '24 13:01 changwsh12

你好,我们已经在修复过程中。

shiyutang avatar Jan 19 '24 07:01 shiyutang

3个月过去了,这个报错依然存在呀: image

BTW, 我训练unet_3plus,即使手动修改train.py注释掉 line 150的 to_static_training=args.to_static_training 也会产生后续的各种问题,比如报错找不到数据集: image

参照其他配置文件增加了train_path: data/dataset/train_list.txt配置后又报错train_path是预期之外的参数。好难啊

image

Alex37882388 avatar Mar 19 '24 07:03 Alex37882388

有解决方法了吗?

tranngocphuong89 avatar May 10 '24 08:05 tranngocphuong89