models icon indicating copy to clipboard operation
models copied to clipboard

按教程进行预训练报错:“finetune_exclude_pretrained_params”

Open ryliu68 opened this issue 6 years ago • 7 comments

按照官方教程(https://github.com/PaddlePaddle/models/tree/develop/PaddleCV/image_classification)进行预训练微调参数,训练自己的数据时需要滤掉最后的FC层报错:”train.py: error: unrecognized arguments: --finetune_exclude_pretrained_params=fc_offset,fc_weights“

错误很明显:官方的train.py代码中没有“finetune_exclude_pretrained_params”参数,请官方人员回复一下,如果没有这个参数,我做微调如何去掉最后一层的参数呢???

1)官方给的命令: python train.py
--data_dir=./data/ILSVRC2012/
--total_images=1281167
--class_dim=1000
--validate=True
--model=ResNet50_vd
--batch_size=256 \
--lr=0.1
--num_epochs=200
--model_save_dir=output/
--l2_decay=7e-5
--pretrained_model=${path_to_pretrain_model}
--finetune_exclude_pretrained_params=fc_0.w_0,fc_0.b_0

2)我的命令: python train.py --model=DPN107 --data_dir=input_image/train_images --total_images=20580 --class_dim=120 --batch_size=30 --pretrained_model=models_parameters/pretrained_model/DPN107 --model_save_dir=models_parameters/training_model/DPN107 --finetune_exclude_pretrained_params=fc_offset,fc_weights

ryliu68 avatar Jan 03 '20 14:01 ryliu68

请更新代码~

shippingwang avatar Jan 04 '20 10:01 shippingwang

请更新代码~

代码是官方的,谢谢

ryliu68 avatar Jan 04 '20 10:01 ryliu68

https://github.com/PaddlePaddle/models/blob/9b50a73c0281b2fa6c226cd1a0637108c51e7695/PaddleCV/image_classification/utils/utility.py#L102

最近models develop分支有更新,该参数已经加上了,请使用develop分支最新的代码

kuke avatar Jan 05 '20 03:01 kuke

https://github.com/PaddlePaddle/models/blob/9b50a73c0281b2fa6c226cd1a0637108c51e7695/PaddleCV/image_classification/utils/utility.py#L102

最近models develop分支有更新,该参数已经加上了,请使用develop分支最新的代码

能否把 finetune_exclude_pretrained_params 这个改成 bool型的呢,意思试如果是True,则根据模型名称,自动exclude 对应的 参数,而不需要自动输入需要 排除的参数名称。

chliang avatar Jan 05 '20 06:01 chliang

好的,谢谢你们哇。辛苦啦。

发送自 Windows 10 版邮件https://go.microsoft.com/fwlink/?LinkId=550986应用


发件人: Yibing Liu [email protected] 发送时间: Sunday, January 5, 2020 11:56:37 AM 收件人: PaddlePaddle/models [email protected] 抄送: LRY0111 [email protected]; Author [email protected] 主题: Re: [PaddlePaddle/models] 按教程进行预训练报错:“finetune_exclude_pretrained_params” (#4153)

https://github.com/PaddlePaddle/models/blob/9b50a73c0281b2fa6c226cd1a0637108c51e7695/PaddleCV/image_classification/utils/utility.py#L102

最近models develop分支有更新,改参数已经加上了,请使用develop分支最新的代码

― You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/PaddlePaddle/models/issues/4153?email_source=notifications&email_token=AFUZSAUVN6LOESDMRQCKUGLQ4FK7LA5CNFSM4KCOG4DKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEIDIBBI#issuecomment-570851461, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AFUZSAUYPNRLKFQQCBFYWQ3Q4FK7LANCNFSM4KCOG4DA.

ryliu68 avatar Jan 05 '20 07:01 ryliu68

@chliang 这样可能不太灵活,exclude的参数只依赖于不同的模型,都变成固定的了

kuke avatar Jan 06 '20 09:01 kuke

@chliang 这样可能不太灵活,exclude的参数只依赖于不同的模型,都变成固定的了

好的 谢谢

chliang avatar Jan 07 '20 11:01 chliang