mmpretrain icon indicating copy to clipboard operation
mmpretrain copied to clipboard

[Bug] I encountered a problem while fine-tuning the model on a custom dataset.

Open Leezp99 opened this issue 2 years ago • 4 comments

Branch

main branch (mmpretrain version)

Describe the bug

I followed the instructions at https://mmpretrain.readthedocs.io/zh_CN/latest/notes/finetune_custom_dataset.html to fine-tune the model, but I encountered an issue in the custom dataset: "init() got an unexpected keyword argument 'split'". How can I resolve this problem? I noticed that someone else has also faced the same issue. Can you tell me how to fix it? The link is here: "https://github.com/open-mmlab/mmpretrain/discussions/1696".

Environment

base = [ '../base/models/resnet50.py', '../base/datasets/imagenet_bs32.py', '../base/schedules/imagenet_bs256.py', '../base/default_runtime.py' ]

模型设置

model = dict( backbone=dict( frozen_stages=2, init_cfg=dict( type='Pretrained', checkpoint='https://download.openmmlab.com/mmclassification/v0/resnet/resnet50_8xb32_in1k_20210831-ea4938fc.pth', prefix='backbone', )), head=dict(num_classes=12), )

数据设置

data_root = 'data/custom_dataset' train_dataloader = dict( batch_size=256, dataset=dict( type='CustomDataset', data_root=data_root, ann_file='', data_prefix='train', with_label=True, )) val_dataloader = dict( dataset=dict( type='CustomDataset', data_root=data_root, ann_file='', data_prefix='val', with_label=True, )) test_dataloader = dict( dataset=dict( type='CustomDataset', data_root=data_root, ann_file='', data_prefix='test', with_label=True, ))

test_dataloader = val_dataloader

训练策略设置

optim_wrapper = dict( optimizer=dict(type='SGD', lr=0.01, momentum=0.9, weight_decay=0.0001)) param_scheduler = dict( type='MultiStepLR', by_epoch=True, milestones=[15], gamma=0.1)

Other information

No response

Leezp99 avatar Aug 05 '23 13:08 Leezp99

what's your mmegine, mmpretrain, mmcv version?

Ezra-Yu avatar Aug 07 '23 02:08 Ezra-Yu

same error

Kailthen avatar Aug 14 '23 09:08 Kailthen

add split='' to class CustomDataset,i solved this issue image

fenghuoxiguozu avatar Aug 16 '23 03:08 fenghuoxiguozu

Is a fix for this gonna land? I'm just following the basic custom dataset docs that the OP mentioned. This is my first time using the library and it doesn't give me warm-fuzzy's that the tutorial has been broken since at least August

csaroff avatar Dec 10 '23 07:12 csaroff