Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

在AI studio别人的公开项目的基础上,改动配置文件来使用自建数据集进行训练,发生‘metaclass conflict‘错误 #3668

Open
1 task done
X-MingYang opened this issue Mar 16, 2024 · 1 comment
Assignees
Labels
question Further information is requested

Comments

@X-MingYang
Copy link

问题确认 Search before asking

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

请提出你的问题 Please ask your question

原项目链接:https://aistudio.baidu.com/projectdetail/2089732?channelType=0&channel=0
本人数据集按照官方文档进行搭建:
https://github.com/PaddlePaddle/PaddleSeg/blob/release/2.9/docs/data/transform/transform_cn.md
对于配置文件只改动了【num_classes】、【dataset_root】、【train_path】、【val_path】。发生报错如图所示
1
2
##本人改动过的ocrnet_dlrsd.yml
base: './configs/base/dlrsd.yml'

batch_size: 2
iters: 160000

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

optimizer:
type: sgd

lr_scheduler:
type: PolynomialDecay
learning_rate: 0.01
power: 0.9

loss:
types:
- type: CrossEntropyLoss
- type: CrossEntropyLoss
coef: [1, 0.4]

##本人改动过的dlrsd.yml
batch_size: 2
iters: 80000

train_dataset:
type: Dataset
dataset_root: home/aistudio/data/labeldata/labeldata
train_path: home/aistudio/data/labeldata/labeldata/train.txt
num_classes: 20
transforms:
- type: ResizeStepScaling
min_scale_factor: 0.5
max_scale_factor: 2.0
scale_step_size: 0.25
- type: RandomPaddingCrop
crop_size: [640, 640]
- type: RandomHorizontalFlip
- type: Normalize
mode: train

val_dataset:
type: Dataset
dataset_root: home/aistudio/data/labeldata/labeldata
val_path: home/aistudio/data/labeldata/labeldata/val.txt
num_classes: 20
transforms:
- type: Normalize
mode: val

optimizer:
type: sgd
momentum: 0.9
weight_decay: 4.0e-5

lr_scheduler:
type: PolynomialDecay
learning_rate: 0.01
end_lr: 0
power: 0.9

loss:
types:
- type: CrossEntropyLoss
coef: [1]

原项目中的对应配置文件如下:
##原项目中的ocrnet_dlrsd.yml
base: './configs/base/dlrsd.yml'

batch_size: 2
iters: 160000

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

optimizer:
type: sgd

lr_scheduler:
type: PolynomialDecay
learning_rate: 0.01
power: 0.9

loss:
types:
- type: CrossEntropyLoss
- type: CrossEntropyLoss
coef: [1, 0.4]

##原项目中的dlrsd.yml
batch_size: 2
iters: 80000

train_dataset:
type: Dataset
dataset_root: dataset/dlrsd
train_path: dataset/dlrsd/train.txt
num_classes: 18
transforms:
- type: ResizeStepScaling
min_scale_factor: 0.5
max_scale_factor: 2.0
scale_step_size: 0.25
- type: RandomPaddingCrop
crop_size: [256, 256]
- type: RandomHorizontalFlip
- type: Normalize
mode: train

val_dataset:
type: Dataset
dataset_root: dataset/dlrsd
val_path: dataset/dlrsd/val.txt
num_classes: 18
transforms:
- type: Normalize
- type: Resize
target_size: [256, 256]
mode: val

optimizer:
type: sgd
momentum: 0.9
weight_decay: 4.0e-5

lr_scheduler:
type: PolynomialDecay
learning_rate: 0.01
end_lr: 0
power: 0.9

loss:
types:
- type: CrossEntropyLoss
coef: [1]
image
万望各位大佬指点一二!

@X-MingYang X-MingYang added the question Further information is requested label Mar 16, 2024
@X-MingYang X-MingYang changed the title 在AI studio别人的公开项目的基础上,改动配置文件来使用自建数据集进行训练,发生‘metaclass conflic’t错误 在AI studio别人的公开项目的基础上,改动配置文件来使用自建数据集进行训练,发生‘metaclass conflict‘错误 Mar 16, 2024
@shiyutang
Copy link
Collaborator

你好,请尝试删除"meta=ABCMeta"后查看是否会持续产生这个错误,“meta=ABCMeta”用于指定继承类为抽象类而非实现类,根据代码判断这是一个风格比较混合,在forward中有具体实现的类,因此可以尝试去除继承ABCMeta。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants