首页 Paddle框架 帖子详情
飞桨领航团开学新人赛——基于PaddleX的简明猫图像分类,模型训练报错
收藏
快速回复
Paddle框架 问答模型训练 159 5
飞桨领航团开学新人赛——基于PaddleX的简明猫图像分类,模型训练报错
收藏
快速回复
Paddle框架 问答模型训练 159 5

进入基于PaddleX的简明猫图像分类公开项目(https://aistudio.baidu.com/aistudio/projectdetail/2455568?forkThirdPart=1),运行至模型训练部分代码,报错:Shape of pretrained params out.weight doesn't match.(Pretrained: [2048, 1000], Actual: [2048, 12])

完整报错代码如下

2021-10-10 19:56:25 [INFO] Loading pretrained model from output/ResNet101_vd_ssld/pretrain/ResNet101_vd_ssld_pretrained.pdparams
2021-10-10 19:56:28 [WARNING] [SKIP] Shape of pretrained params out.weight doesn't match.(Pretrained: [2048, 1000], Actual: [2048, 12])
2021-10-10 19:56:28 [WARNING] [SKIP] Shape of pretrained params out.bias doesn't match.(Pretrained: [1000], Actual: [12])
2021-10-10 19:56:28 [INFO] There are 530/532 variables loaded into ResNet101_vd_ssld.

---------------------------------------------------------------------------KeyboardInterrupt Traceback (most recent call last) in
14 pretrain_weights='IMAGENET',
15 save_dir='output/ResNet101_vd_ssld',
---> 16 use_vdl=True)
/opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/paddlex/cv/models/classifier.py in train(self, num_epochs, train_dataset, train_batch_size, eval_dataset, optimizer, save_interval_epochs, log_interval_steps, save_dir, pretrain_weights, learning_rate, warmup_steps, warmup_start_lr, lr_decay_epochs, lr_decay_gamma, early_stop, early_stop_patience, use_vdl, resume_checkpoint)
286 early_stop=early_stop,
287 early_stop_patience=early_stop_patience,
--> 288 use_vdl=use_vdl)
289
290 def quant_aware_train(self,
/opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/paddlex/cv/models/base.py in train_loop(self, num_epochs, train_dataset, train_batch_size, eval_dataset, save_interval_epochs, log_interval_steps, save_dir, ema, early_stop, early_stop_patience, use_vdl)
327 step_time_tic = time.time()
328
--> 329 for step, data in enumerate(self.train_data_loader()):
330 if nranks > 1:
331 outputs = self.run(ddp_net, data, mode='train')
/opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/paddle/fluid/dataloader/dataloader_iter.py in __next__(self)
563
564 if in_dygraph_mode():
--> 565 data = self._reader.read_next_var_list()
566 data = _restore_batch(data, self._structure_infos.pop(0))
567 else:
KeyboardInterrupt:

0
收藏
回复
全部评论(5)
三岁
#2 回复于2021-10-10

兄弟,你的项目没有公开,然后你看一下网络,应该是网络有问题

 

0
回复
三岁
#3 回复于2021-10-10

或者是数据批处理的问题

0
回复
W
WhitbyLi
#4 回复于2021-10-11
三岁 #2
兄弟,你的项目没有公开,然后你看一下网络,应该是网络有问题  

在飞桨的项目库中,看到别人有完成这个项目,运行一下,链接是:https://aistudio.baidu.com/aistudio/projectdetail/2417311?channelType=0&channel=0

0
回复
三岁
#5 回复于2021-10-11
在飞桨的项目库中,看到别人有完成这个项目,运行一下,链接是:https://aistudio.baidu.com/aistudio/projectdetail/2417311?channelType=0&channel=0
展开

他们的项目没有问题啊

0
回复
炼丹师233
#6 回复于2021-10-11

你是不是少运行了 model = pdx.cls.ResNet101_vd_ssld( num_classes=len(train_dataset.labels) ) ,没有指定预训练模型的分类任务


或者试试重新fork再运行次看看吧

0
回复
需求/bug反馈?一键提issue告诉我们
发现bug?如果您知道修复办法,欢迎提pr直接参与建设飞桨~
在@后输入用户全名并按空格结束,可艾特全站任一用户