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

semantic loss不能很好收敛及训练策略问题 #135

Open
imliupu opened this issue Aug 20, 2021 · 7 comments
Open

semantic loss不能很好收敛及训练策略问题 #135

imliupu opened this issue Aug 20, 2021 · 7 comments

Comments

@imliupu
Copy link

imliupu commented Aug 20, 2021

您好,十分感谢您的分享及热情的回复。

我主要有2个问题想请教您:

一.

对于开源的模型,在我具体使用的过程中,如果不针对自己数据做微调或者运用 SOC,效果不太理想。但是我在微调的过程中遇到一个问题,由于目标域数据分布可能与您提供的模型所用源域数据分布差异较大,导致模型在 train 模式下 loss 很大(batchnorm引起),从而失去预训练的效果,于是我尝试在 eval 模型下进行微调,可以在目标域数据上取得不错的效果。

尽管在 eval 模式下微调可以取得不错的效果,但我还是想用 train 训练,找一个适合目标域数据集的均值方差,但是我从头开始或者使用 train 模式微调都无法很好地收敛(都无法匹配在 eval 上进行微调的效果),特别是 semantic loss,要比 eval 下微调大很多,论文中有提到将 mobilenetv2Super... 数据集上预训练,如果猜想没错的话,这一部分是主要决定 semantic loss 的因素,所以我想请问下开源模型具体的训练策略是什么样呢?下面是我的猜想,请您纠正下:

1.在 Super... 数据集上预训练,仅用 semantic loss 进行更新

2.在1.的基础上整个模型端到端进行训练

请问是否还有其他特殊的训练步骤呢?如果是,那么 1 具体的操作是什么呢?训练多少个epoch,采用何种学习策略
谢谢!

补充下分别在 train 模式和 eval 模式进行微调的 loss 情况图:

图 1 为 train 模式下微调,采用 Adam,由于 batchnorm 均值方差不可用,loss较大,因此学习率设置较大,lr = 0.0002,训练了 50 个 epoch,每 10 个 epoch lr = lr * 0.1。
图 2 为 eval 模式下微调,采用 Adam,lr = 0.00001, 训练 20 个 epoch。

train

eval

由图可见,在 eval 模式下的 semantic loss 明显收敛得更快更好,稳定< 0.001,而 train 模式下则一直在 0.001 震荡,基本 > 0.001。

导致这个发生的原因是否是因为目标域数据集数量过少(约7k张),且场景比较单一,和常见公开数据集分布差异较大,从而无法学到一个合适的均值方差,能否提供一些您的见解与解决方式?

二.

训练过程中使用了哪些数据增强策略?除了论文中介绍的 DIM 所采用的合成图,是否使用了 随机缩放,随机剪裁 等方法?我在实验中发现加入 随机剪裁 之后,由于部分剪裁出的图只含有小部分的身体,如某个图里面只露了一只手,这会增加学习的复杂度,反而影响了模式的收敛。请问您在实验中具体使用了哪些有效合理的数据增强策略呢?

@lg920810
Copy link

你这个训练的很好啊,我用的train的模式,我的semantic loss在val上都只能到0.001,detail loss是0.03左右,和你的结果差了一个量级呢

@imliupu
Copy link
Author

imliupu commented Aug 24, 2021

你这个训练的很好啊,我用的train的模式,我的semantic loss在val上都只能到0.001,detail loss是0.03左右,和你的结果差了一个量级呢

我就是想解决 train 模式下无法收敛的问题

@ZHKKKe
Copy link
Owner

ZHKKKe commented Sep 7, 2021

@imliupu
你好,感谢你的关注。
对于你的问题:
Q1. 训练策略。
我们的MobileNetV2使用了 https://github.com/thuyngch/Human-Segmentation-PyTorch 仓库中的预训练模型。在加载预训练模型后直接进行端到端训练。
Q2: 数据增强
我们论文中的实验没有采用其他的数据增强方案。我们在合成数据的时候就引入了随机缩放、裁剪等增强。

@imliupu
Copy link
Author

imliupu commented Sep 16, 2021

@imliupu
你好,感谢你的关注。
对于你的问题:
Q1. 训练策略。
我们的MobileNetV2使用了 https://github.com/thuyngch/Human-Segmentation-PyTorch 仓库中的预训练模型。在加载预训练模型后直接进行端到端训练。
Q2: 数据增强
我们论文中的实验没有采用其他的数据增强方案。我们在合成数据的时候就引入了随机缩放、裁剪等增强。

方便介绍下具体的缩放和裁剪策略吗?

@yashsandansing
Copy link

@imliupu can you please tell me which dataset did you use to get such good results? Even the first iteration in my training leads to a semantic loss of more than 9.0, a detail loss of ~0.5, and a matte loss of ~6.0

@imliupu
Copy link
Author

imliupu commented Oct 25, 2022

@imliupu can you please tell me which dataset did you use to get such good results? Even the first iteration in my training leads to a semantic loss of more than 9.0, a detail loss of ~0.5, and a matte loss of ~6.0

Our own dataset, the scenario is relatively simple.

@zhepherd
Copy link

@imliupu can you please tell me which dataset did you use to get such good results? Even the first iteration in my training leads to a semantic loss of more than 9.0, a detail loss of ~0.5, and a matte loss of ~6.0

i use your train code also have this problem, did you solve this problem?

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

No branches or pull requests

5 participants