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

Wrong detected face saved #218

Open
Jaroslove opened this issue Dec 29, 2023 · 0 comments
Open

Wrong detected face saved #218

Jaroslove opened this issue Dec 29, 2023 · 0 comments

Comments

@Jaroslove
Copy link

Hi Team,

I use facenet_pytorch to detect faces in a image, save extracted faces to a blob storage and get vectors from extracted faces.

I wrote a following code:

        file_bytes: bytes = await file.read()
        nparr = np.frombuffer(file_bytes, np.uint8)
        image = cv2.imdecode(nparr, cv2.IMREAD_COLOR)
        cropped = mtcnn(image)
        if cropped is not None:
            name = f"{uuid.uuid4()}.jpg"
            full_path = os.path.join(image_blob_storage_path, name)
            cropped = cropped.numpy()
            if isinstance(cropped, np.ndarray):
                cv2.imwrite(full_path, cv2.cvtColor(cropped, cv2.COLOR_RGB2BGR))
            else:
                cropped.save(full_path)
            return encode(cropped)
        return []

When I test this code extracted faces saved but I cannot see any face on saved images, it's just dots.
Could you provide for me any help, please?

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