0

When I am importing the package ArcFace.

from arcface.metrics import ArcFace

It is showning the import error. Like this,

ModuleNotFoundError                       Traceback (most recent call last)
<ipython-input-4-fe2759a1802e> in <module>
     15 from keras.layers.convolutional import MaxPooling2D
     16 from keras.layers.core import Activation, Flatten, Dropout, Dense
---> 17 from arcface.metrics import ArcFace
     18 from keras.layers import Input
     19 from keras import backend as K

ModuleNotFoundError: No module named 'arcface'

I have searched for importing it for Anaconda and pip too. I have not found any results. Please help me to solve this.

  • module may have different name and you should check it with Google – furas Sep 09 '20 at 08:52
  • Its actually apart of facelib. But this code I got it from GitHub. I have installed that facelib library. But still the same result. – tallamtharun sai Sep 10 '20 at 04:38
  • is this your code or code in some module or code from some tutorial? I don't see `arcface` in `facelib` repo. It mentions [insightface](https://github.com/deepinsight/insightface) and I found [insightface/recognition/ArcFace](https://github.com/deepinsight/insightface/tree/master/recognition) but still it is not `arcface.metrics.ArcFace`. I tried to search `arcface.metrics` with Google and I found only [keras-arcface.metrics.ArcFace](https://github.com/4uiiurz1/keras-arcface/blob/master/metrics.py) – furas Sep 10 '20 at 07:33
  • You can check in the link here. [link](https://github.com/4uiiurz1/keras-arcface/issues/2). In this you can get some clarity. But I have tried the code but not working. – tallamtharun sai Sep 11 '20 at 08:18
  • `keras-arcface` is not part of `keras` and you have to install it separatelly. If you put it in your project in folder `arcface` then you can import it as `from arcface.metrics import ArcFace` – furas Sep 11 '20 at 08:40
  • OK, I got it. Thank you so much for your time and explanation. – tallamtharun sai Sep 11 '20 at 08:43

2 Answers2

1

This is part of project keras-arcface but it is not part of keras so you have to install/copy it separatelly.

If you put it in your project in subfolder arcface then it should work.

furas
  • 134,197
  • 12
  • 106
  • 148
1

You can run ArcFace within deepface. The framework is mainly based on keras and tensorflow. It handles model building and downloading pre-trained weights in the background. Besides, it covers face recognition pipeline stages includign detect, align.

#!pip install deepface
from deepface import DeepFace
resp = DeepFace.verify("img1.jpg", "img2.jpg", model_name = 'ArcFace')
johncasey
  • 1,250
  • 8
  • 14