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

Batch Inference with RetinaFace is slower than single image inference of Insightface #5

Open
zeahmd opened this issue Feb 28, 2022 · 0 comments

Comments

@zeahmd
Copy link

zeahmd commented Feb 28, 2022

`
import numpy as np
from insightface.app import FaceAnalysis
import cv2
import matplotlib.pyplot as plt
import time
from batch_face import RetinaFace

img = cv2.imread('/home/zeeshan/Downloads/musk.jpg')
img = cv2.cvtColor(img, cv2.COLOR_BGR2RGB)
img = cv2.resize(img, (640, 640))
plt.imshow(img)

model = FaceAnalysis(allowed_modules=['detection'],
providers=['CUDAExecutionProvider', 'CPUExecutionProvider'])
model.prepare(ctx_id=0)
detector = RetinaFace(gpu_id=0)

tik = time.time()
faces = model.get(img)
faces = model.get(img)
faces = model.get(img)
faces = model.get(img)
faces = model.get(img)
print(f"time taken: {time.time()-tik}")

tik = time.time()
faces = detector.detect([img, img, img, img, img])
print(f"time taken: {time.time()-tik}")
`
@elliottzheng could you please have a look at this code and help me to solve this issue?

@zeahmd zeahmd changed the title Batch Inference with RetinaFace is slower than single image of Insightface Batch Inference with RetinaFace is slower than single image inference of Insightface Mar 1, 2022
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

1 participant