keras-cv icon indicating copy to clipboard operation
keras-cv copied to clipboard

Add ArcFace loss.

Open innat opened this issue 2 years ago • 12 comments

System information.

TensorFlow version (you are using): 2.8 Are you willing to contribute it (Yes/No) : No (but willing to provide starter if required.)

Describe the feature and the current behavior/state.

ArcFace, or Additive Angular Margin Loss, is a loss function used mainly in face recognition tasks. It is used to obtain highly discriminative features. This loss function can be used in both vision task and nlp task. So, I think its general for keras_cv and keras_nlp.

Paper: https://arxiv.org/pdf/1801.07698.pdf, TL,DR, https://paperswithcode.com/method/arcface Citation: 2939 (current)

Will this change the current api? How?


tf.keras.losses.SparseArcFace
tf.keras.losses.CategoricalArcFace

Who will benefit from this feature?

keras practitioners.

Contributing

  • Briefly describe your candidate solution(if contributing):
    • https://github.com/4uiiurz1/keras-arcface

innat avatar Jun 21 '22 08:06 innat

ArcFace, or Additive Angular Margin Loss, is a loss function used mainly in face recognition tasks

What are some NLP use cases? It seems like it might be a good fit for KerasCV specifically.

fchollet avatar Jun 29 '22 20:06 fchollet

Sorry I miswrote, it should be only CV task. Could you please move this issue to KerasCV?

innat avatar Jun 29 '22 21:06 innat

Hey, @LukeWood @sayakpaul I think this would be a great feature addition to KerasCV. It's especially popular in Kaggle competitions for reference.

Please assign it to me.

ayulockin avatar Jul 21 '22 04:07 ayulockin

I concur. Especially for retrieval tasks, ArcFace loss is greatly beneficial.

sayakpaul avatar Jul 21 '22 05:07 sayakpaul

interesting, can this be used with the existing models we have? i.e. if we add this will we have the tools we need to support facial recognition?

LukeWood avatar Jul 22 '22 21:07 LukeWood

Should be compatible with existing models.

sayakpaul avatar Jul 22 '22 21:07 sayakpaul

So theoretically, we include this, and use this loss to create a facial recognition tutorial with the other existing components?

LukeWood avatar Jul 22 '22 22:07 LukeWood

Shoul be the case. We have a tutorial on few-shot learning and we coul definitely take some components from that too.

sayakpaul avatar Jul 22 '22 22:07 sayakpaul

Shoul be the case. We have a tutorial on few-shot learning and we coul definitely take some components from that too.

ok, sounds good. Then I think this is a great component. Especially if we can include a tutorial on facial recognition.

LukeWood avatar Jul 22 '22 22:07 LukeWood

@ayulockin take it for the grab if you're up.

sayakpaul avatar Jul 22 '22 22:07 sayakpaul

When we do include this I do think it’s important to have a tutorial showing off how to use it, so let’s keep that in mind! Doesn’t have to be anything crazy, just some basics!

LukeWood avatar Jul 23 '22 01:07 LukeWood

This loss is compatible with existing models.

I can take this up. Will start working on it soon. Also the idea of tutorial is great for this loss.

ayulockin avatar Jul 23 '22 04:07 ayulockin

Would love to work on this if no one has picked up still.

yashchks87 avatar Jan 31 '23 19:01 yashchks87

Any updates on this?

alexandrekj avatar May 15 '23 09:05 alexandrekj

It looks like this fell through the cracks @alexandrekj. @yashchks87 or @alexandrekj, are either of you interested in working on this?

jbischof avatar May 15 '23 14:05 jbischof

I can take on it. @jbischof

yashchks87 avatar May 15 '23 14:05 yashchks87