Skip to content

How to determine if face detect or face recognise? #14

Open

Description

@robmarkcole

Have 2 endpoints, but should I have one detect method with an optional arg ,or two seperate methods?

e.g.
process_file(image_path, recognise=True) # default recognise=False uses detection

Activity

  1. robmarkcole commented on Jun 10, 2020

    @robmarkcole
    OwnerAuthor

    The only difference with face recognition is that user_id is also returned. Handlign this in HA integration with:

    def parse_faces(predictions):
        """Get recognised faces for the image_processing.detect_face event."""
        faces = []
        for entry in predictions:
            if not "userid" in entry.keys():
                break  # we are in detect_only mode
            if entry["userid"] == "unknown":
                continue
            face = {}
            face["name"] = entry["userid"]
            face[ATTR_CONFIDENCE] = round(100.0 * entry["confidence"], 2)
            faces.append(face)
        return faces
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions