LibFewShot学习使用过程中的一些困惑。 #55
-
Libfewshot中把数据集分为train、val和test,比如,miniImagenet数据集有100个class,被分成train set、val set、test set;
据我了解,meta learning是在taskA、taskB、……上进行训练,然后在new task上进行少量的训练即可得到较好的结果。在miniImagenet上训练时的确也是按照这个思路来的,分成了train class和test class。现在假设我已经用miniImagenet训好了一个模型(5-way 5-shot) |
Beta Was this translation helpful? Give feedback.
Replies: 7 comments 9 replies
-
|
Beta Was this translation helpful? Give feedback.
-
打扰各位了,这个邮件一直抄送给我,N久了,为防泄密,能否取消抄送我呀,麻烦了~
王梦琪 采购专员
曙光信息产业股份有限公司
南京市江宁区诚信大道519号芳园中路 211100
电话:-
传真:025-84721630-808
手机:13255265831
股票代码:603019
发件人: MasterWinston
发送时间: 2022-10-10 19:27
收件人: RL-VIG/LibFewShot
抄送: Subscribed
主题: Re: [RL-VIG/LibFewShot] LibFewShot学习使用过程中的一些困惑。 (Discussion #55)
好的十分感谢!
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
你好,你的reply 2.中关于“分类头和way有关不能沿用原来分类头”我有一些困惑,希望能够得到你的帮助。
我在使用Libfewshot中提供的reproduce权重(renet 5-way-5shot backbone:resnet12)在自己的4class数据集上微调时依旧沿用原来的renet分类头,在训练时报错,具体信息见附件err_log2_renet.txt。部分错误信息如下:
File "E:\wansongbo\LibFewShot\core\data\collates\collate_functions.py", line 160, in method
-1, self.way_num, self.shot_num + self.query_num
RuntimeError: shape '[-1, 4, 14]' is invalid for input of size 64
我简单的将分类头中的num_classs从64改为4后报错信息不变。然后我又将query_num改为12后,出现了新的报错,详细信息见err_log1_renet.txt。部分错误信息如下:
File "E:\wansongbo\LibFewShot\core\model\finetuning\renet.py", line 384, in set_forward
ep_images, _ = batch
ValueError: too many values to unpack (expected 2)
我想知道要如何设置新的分类头来适配 Libfewshot中提供的reproduce权重(renet 5-way-5shot backbone:resnet12) 呢?如果我的数据集有>=5class时能否沿用原来分类头呢?
PS:在上面的两个报错log信息中,都是在epoch0训练100个episode(train_episode:1000)后直接结束——train on train set——,这个原因我也不知道是为啥。
…------------------ 原始邮件 ------------------
发件人: "RL-VIG/LibFewShot" ***@***.***>;
发送时间: 2022年10月9日(星期天) 晚上8:57
***@***.***>;
***@***.******@***.***>;
主题: Re: [RL-VIG/LibFewShot] LibFewShot学习使用过程中的一些困惑。 (Discussion #55)
val集仍然是用来挑选最优模型,参考https://github.com/RL-VIG/LibFewShot/blob/f002bf351f46ff68664906c4903916983abc2f02/core/trainer.py#L102-L110 ,训练阶段的text on test set只是用来更直观地感受模型训练过程,给分析调优提供信息。在现在的数据集分割中,train/val/test都不相交,你说的76:24的数据集分割策略有具体的论文可以参考吗,可以拿来再讨论。
理论上是可以的,你其实想做的是在新数据集上迁移模型并微调,一般我们会在配置文件中填写预训练好的backbone权重来微调,而不是以resume的方式来继续训练,因为这可能带来一些例如学习率、学习率调度器上的问题。当你的微调任务和预训练任务的way不同时,如果你使用的是ProtoNet这种模型,是可以的,因为他和way无关,也没有额外参数;但是如果用的是和way相关的分类头,那么就不能沿用原来模型的分类头,在微调时需要对新分类头适当调整学习率。
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you authored the thread.Message ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
附件好像并不会上传到github上。
我附件直接发送到你的个人邮箱可以吗
…------------------ 原始邮件 ------------------
发件人: "RL-VIG/LibFewShot" ***@***.***>;
发送时间: 2022年10月13日(星期四) 下午3:22
***@***.***>;
***@***.******@***.***>;
主题: Re: [RL-VIG/LibFewShot] LibFewShot学习使用过程中的一些困惑。 (Discussion #55)
你好,看不到附件。
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
附件发你个人邮箱了
另外这是我刚create的gist,链接是:https://gist.github.com/MasterWinston/d4b5ba578c90fca610383c20705dede7
…------------------ 原始邮件 ------------------
发件人: "RL-VIG/LibFewShot" ***@***.***>;
发送时间: 2022年10月13日(星期四) 下午3:38
***@***.***>;
***@***.******@***.***>;
主题: Re: [RL-VIG/LibFewShot] LibFewShot学习使用过程中的一些困惑。 (Discussion #55)
好的,或者使用gist也可以
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
感谢,修改后训练已正常。
…------------------ 原始邮件 ------------------
发件人: "RL-VIG/LibFewShot" ***@***.***>;
发送时间: 2022年10月13日(星期四) 下午4:15
***@***.***>;
***@***.******@***.***>;
主题: Re: [RL-VIG/LibFewShot] LibFewShot学习使用过程中的一些困惑。 (Discussion #55)
我们排查后,建议回退下你的修改,并修改下面的代码
https://github.com/RL-VIG/LibFewShot/blob/f002bf351f46ff68664906c4903916983abc2f02/core/data/dataloader.py#L83
改成
if config["dataloader_num"] == 1 or mode in ["val", "test"]:
这部分由于疏忽没有考虑到ReNet方法的验证过程,后续会进行修改。
另外,100episode问题:应该是数据集和配置不一致的问题,RENet训练时需要保证训练集样本数/batch_size = train_episode,否则会出现一个batch dataloader已经读完却还要再读取的情况,你的数据集应该很小,与配置的train_episode:1000 batch_size:64有冲突。
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
你好,请问Libfewshot库中是不是没有maml_resnet12_miniImagenet训练的权重文件?
我在采用以上方式从头训练出现了错误,大致是在epoch 0 train完成后 在——val on val set——时报错CUDA out of memory。
我已经把相关参数调到比较小的水平,但是我发现在训练过程中GPU占用率98%(总共24576M)。
请问是什么原因导致的呢?
训练过程的全部信息的gist链接如下:
https://gist.github.com/MasterWinston/d4b5ba578c90fca610383c20705dede7
报错信息在最新的file中。
…------------------ 原始邮件 ------------------
发件人: "RL-VIG/LibFewShot" ***@***.***>;
发送时间: 2022年10月13日(星期四) 下午4:15
***@***.***>;
***@***.******@***.***>;
主题: Re: [RL-VIG/LibFewShot] LibFewShot学习使用过程中的一些困惑。 (Discussion #55)
我们排查后,建议回退下你的修改,并修改下面的代码
https://github.com/RL-VIG/LibFewShot/blob/f002bf351f46ff68664906c4903916983abc2f02/core/data/dataloader.py#L83
改成
if config["dataloader_num"] == 1 or mode in ["val", "test"]:
这部分由于疏忽没有考虑到ReNet方法的验证过程,后续会进行修改。
另外,100episode问题:应该是数据集和配置不一致的问题,RENet训练时需要保证训练集样本数/batch_size = train_episode,否则会出现一个batch dataloader已经读完却还要再读取的情况,你的数据集应该很小,与配置的train_episode:1000 batch_size:64有冲突。
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
val集仍然是用来挑选最优模型,参考
LibFewShot/core/trainer.py
Lines 102 to 110 in f002bf3
理论上是可以的,你其实想做的是在新数据集上迁移模型并微调,一般我们会在配置文件中填写预训练好的backbone权重来微调,而不是以resume的方式来继续训练,因为这可能带来一些例如学习率、学习率调度器上的问题。当你的微调任务和预训练任务的way不同时,如果你使用的…