deepinsight / deepinsight/insightface
inference slows down dramatically
- Dominant language
- Python
- Stars
- 29.7k
- Forks
- 6.1k
- PR merge metrics
- No merged PRs in 30d
Description
Thanks for the great work!
I have several photos collected from social networks. I'm trying to get embeddings from this images in Colab (onnxruntime-gpu==1.8).
After a few iterations inference slows down (from 13 it/s to 1.5 it/s)
Code:
```
app = FaceAnalysis(det_name='retinaface_mnet025_v2', rec_name='arcface_r100_v1', ga_name='genderage_v1')
app.prepare(ctx_id=0, det_size=(640, 640))
def main(db, app):
d = 512
number_of_faces = 56233
xb = np.ndarray(shape=(number_of_faces, d)).astype('float32')
a = []
for photo_path in tqdm.tqdm(db):
embeddings = app.get(get_image(os.path.join("my/path", photo_path)))
for e in embeddings:
a.append([photo_path[0:-5], e.embedding.astype('float32')])
if len(a) and len(a) % 1000 == 0:
db_np = np.array(a)
print("---", sys.getsizeof(a), "---")
np.save("/embeddings/path/" + str(len(a)), db_np)
return a
a = main(os.listdir("my/path"), app)
```

I also have noticed that GPU memory is occupied even after the main code finishes and I can't execute the cell again due to the memory allocation error.
Could you please help me to get over this trouble.
P.S. I have changed get_image so that not to cache images.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.