-
Notifications
You must be signed in to change notification settings - Fork 56
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
Is there any update plan for Adaface? #91
Comments
I will take a check, thanks for the reminding. Just currently occupied with something else. For this project, I'm trying |
我看他们训练clip多模态预训练模型的时候有的人用过 Gradient Accumulation,你看看有没有能帮到你的 |
|
在做了在做了,已经把 webface4m 和 webface12m 的 r100 模型转化出来了,跑跑验证就开始写损失函数了。 |
|
adaface和magface都有个反映人脸图片质量的方式,做个norm啥的就行,你有注意过吗 |
对的,Converted MagFace / AdaFace r50 / r100 model and face quality testing #57 这里就是用 norm 值作为人脸质量值在 cfp_fp / agedb_30 上的测试 |
你这手也太快了,有模型吗,我自己训练的感觉没啥效果啊,为啥模糊的比好的分还高 |
哦刷新看到模型了,我试试 |
人脸质量测试感觉不如 magface,还得看看论文人家是怎么用的。Readme 里 |
另外还有一个使用 MagFace 结果再做人脸质量训练的 QMagFace: Simple and Accurate Quality-Aware Face Recognition |
|
1、torch模型怎么移植成tf的格式嘞,需要换框架复现代码重新训练,还是把权重拿出来就行了 |
|
你 是 我的神 |
倒是也不必 |
我把keras_cv_attention_models里面的download_and_load和test_images放到项目里,然后把adaface里面的net和head也放进去,下的ckpt就是“adaface_ir101_webface4m.ckpt”,但是我在convert的时候报错了
具体的在'stack1_block1_shortcut_conv'在这层里面维度不是普通卷积,没法进行transpose 还需要改啥吗 |
用的代码是:
|
你的 |
是不是因为源码head刚进来做了个随机初始化的全连接,算出margin loss的cosine。keras的loss进来之前你已经在上面做过norm了,所以不具备数值意义上的可比性。如果观察backprop的复现效果的话,一般是大概差不多,符合论文说明,收敛就行了,还是要像个办法严格控制数值呢 |
啊,你说这个,这个对比测试需要改一下代码:
|
你上面的模型转化成功了吗? |
成功惹!应该就是shortcut的原因 |
具体有啥地方需要改吗,感觉没啥差别哎。是两个框架stop gradient的逻辑不一样吗 |
更新了,因为训练还没有跑完,之前这部分没有更新 |
按这样的话,等价的pytorch是不是
还是说torch放外面就可以 |
我对 pytorch 没那么熟悉,根据一些文章来看,比如 Difference between detach().clone() and clone().detach(),我认为 |
这个解释的更好点 Detach, no_grad and requires_grad |
感觉是的,应该就是双保险的意思,或者最多是 |
目前的结果看起来还不错,r50 + SGD + AdaFace 53 epochs: import losses, train, models
import tensorflow_addons as tfa
keras.mixed_precision.set_global_policy("mixed_float16")
data_basic_path = '/datasets/ms1m-retinaface-t1'
data_path = data_basic_path + '_112x112_folders'
eval_paths = [os.path.join(data_basic_path, ii) for ii in ['lfw.bin', 'cfp_fp.bin', 'agedb_30.bin']]
basic_model = models.buildin_models('r50', dropout=0.4, emb_shape=512, output_layer='E', bn_momentum=0.9, bn_epsilon=1e-5, scale=True, use_bias=False, activation='prelu', use_max_pool=True)
basic_model = models.add_l2_regularizer_2_model(basic_model, weight_decay=5e-4, apply_to_batch_normal=False)
tt = train.Train(data_path, eval_paths=eval_paths,
save_path='TT_r50_max_pool_E_prelu_dr04_lr_01_l2_5e4_adaface_emb512_sgd_m09_bs512_ms1m_64_only_margin_SG_scale_true_bias_false_random_100.h5',
basic_model=basic_model, model=None, lr_base=0.1, lr_decay=0.5, lr_decay_steps=16, lr_min=1e-6, lr_warmup_steps=3,
batch_size=512, random_status=100, eval_freq=4000, output_weight_decay=1)
# optimizer = tfa.optimizers.AdamW(learning_rate=1e-2, weight_decay=5e-4, exclude_from_weight_decay=["/gamma", "/beta"])
# optimizer = tfa.optimizers.SGDW(learning_rate=1e-2, weight_decay=5e-6, momentum=0.9, exclude_from_weight_decay=["/gamma", "/beta"])
optimizer = keras.optimizers.SGD(learning_rate=0.1, momentum=0.9)
sch = [
{"loss": losses.AdaFaceLoss(scale=64), "epoch": 53, "optimizer": optimizer},
]
tt.train(sch, 0)
PyTorch 训练 26 epochs 的结果:
|
这个还挺好玩得,感觉接在模型后面就行 |
大概看了下,感觉速度不快的样子,单张图片 |
Adaface + r100 的训练结果这几天应该会上传,53 Epochs 的结果是 IJBB 0.961636,IJBC 0.972849,相对于PyTorch的26 Epochs IJBB 95.84, IJBC 97.09 |
恭喜啊!!!tql!!!那我只用ghostnet就够了!注意身体嗷 |
r100 的训练结果上传了,可以作为训练 ghostnet 的参考 |
FYI https://paperswithcode.com/paper/adaface-quality-adaptive-margin-for-face
The text was updated successfully, but these errors were encountered: