azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/operations/face_operations.py
def find_similar(
            self, face_id, face_list_id=None, large_face_list_id=None, face_ids=None, max_num_of_candidates_returned=20, mode="matchPerson", custom_headers=None, raw=False, **operation_config):
        """Given query face's faceId, to search the similar-looking faces from a
        faceId array, a face list or a large face list. faceId array contains
        the faces created by [Face -
        Detect](/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f30395236),
        which will expire 24 hours after creation. A "faceListId" is created by
        [FaceList -
        Create](/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f3039524b)
        containing persistedFaceIds that will not expire. And a
        "largeFaceListId" is created by [LargeFaceList -
        Create](/docs/services/563879b61984550e40cbbe8d/operations/5a157b68d2de3616c086f2cc)
        containing persistedFaceIds that will also not expire. Depending on the
        input the returned similar faces list contains faceIds or
        persistedFaceIds ranked by similarity.
        <br/>Find similar has two working modes, "matchPerson" and "matchFace".
        "matchPerson" is the default mode that it tries to find faces of the
        same person as possible by using internal same-person thresholds. It is
        useful to find a known person's other photos. Note that an empty list
        will be returned if no faces pass the internal thresholds. "matchFace"
        mode ignores same-person thresholds and returns ranked similar faces
        anyway, even the similarity is low. It can be used in the cases like
        searching celebrity-looking faces.
        <br/>The 'recognitionModel' associated with the query face's faceId
        should be the same as the 'recognitionModel' used by the target faceId
        array, face list or large face list.
        .

        :param face_id: FaceId of the query face. User needs to call Face -
         Detect first to get a valid faceId. Note that this faceId is not
         persisted and will expire 24 hours after the detection call
        :type face_id: str
        :param face_list_id: An existing user-specified unique candidate face
         list, created in Face List - Create a Face List. Face list contains a
         set of persistedFaceIds which are persisted and will never expire.
         Parameter faceListId, largeFaceListId and faceIds should not be
         provided at the same time.
        :type face_list_id: str
        :param large_face_list_id: An existing user-specified unique candidate
         large face list, created in LargeFaceList - Create. Large face list
         contains a set of persistedFaceIds which are persisted and will never
         expire. Parameter faceListId, largeFaceListId and faceIds should not
         be provided at the same time.
        :type large_face_list_id: str
        :param face_ids: An array of candidate faceIds. All of them are
         created by Face - Detect and the faceIds will expire 24 hours after
         the detection call. The number of faceIds is limited to 1000.
         Parameter faceListId, largeFaceListId and faceIds should not be
         provided at the same time.
        :type face_ids: list[str]
        :param max_num_of_candidates_returned: The number of top similar faces
         returned. The valid range is [1, 1000].
        :type max_num_of_candidates_returned: int
        :param mode: Similar face searching mode. It can be "matchPerson" or
         "matchFace". Possible values include: 'matchPerson', 'matchFace'
        :type mode: str or
         ~azure.cognitiveservices.vision.face.models.FindSimilarMatchMode
        :param dict custom_headers: headers that will be added to the request
        :param bool raw: returns the direct response alongside the
         deserialized response
        :param operation_config: :ref:`Operation configuration
         overrides<msrest:optionsforoperations>`.
        :return: list or ClientRawResponse if raw=true
        :rtype: list[~azure.cognitiveservices.vision.face.models.SimilarFace]
         or ~msrest.pipeline.ClientRawResponse
        :raises:
         :class:`APIErrorException<azure.cognitiveservices.vision.face.models.APIErrorException>`
        """
        body = models.FindSimilarRequest(face_id=face_id, face_list_id=face_list_id, large_face_list_id=large_face_list_id, face_ids=face_ids, max_num_of_candidates_returned=max_num_of_candidates_returned, mode=mode)

        # Construct URL
        url = self.find_similar.metadata['url']
        path_format_arguments = {
            'Endpoint': self._serialize.url("self.config.endpoint", self.config.endpoint, 'str', skip_quote=True)
        }
        url = self._client.format_url(url, **path_format_arguments)

        # Construct parameters
        query_parameters = {}

        # Construct headers
        header_parameters = {}
        header_parameters['Accept'] = 'application/json'
        header_parameters['Content-Type'] = 'application/json; charset=utf-8'
        if custom_headers:
            header_parameters.update(custom_headers)

        # Construct body
        body_content = self._serialize.body(body, 'FindSimilarRequest')

        # Construct and send request
        request = self._client.post(url, query_parameters, header_parameters, body_content)
        response = self._client.send(request, stream=False, **operation_config)

        if response.status_code not in [200]:
            raise models.APIErrorException(self._deserialize, response)

        deserialized = None

        if response.status_code == 200:
            deserialized = self._deserialize('[SimilarFace]', response)

        if raw:
            client_raw_response = ClientRawResponse(deserialized, response)
            return client_raw_response

        return deserialized
def find_similar(
            self, face_id, face_list_id=None, large_face_list_id=None, face_ids=None, max_num_of_candidates_returned=20, mode="matchPerson", custom_headers=None, raw=False, **operation_config):
        """Given query face's faceId, to search the similar-looking faces from a
        faceId array, a face list or a large face list. faceId array contains
        the faces created by [Face -
        Detect](/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f30395236),
        which will expire 24 hours after creation. A "faceListId" is created by
        [FaceList -
        Create](/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f3039524b)
        containing persistedFaceIds that will not expire. And a
        "largeFaceListId" is created by [LargeFaceList -
        Create](/docs/services/563879b61984550e40cbbe8d/operations/5a157b68d2de3616c086f2cc)
        containing persistedFaceIds that will also not expire. Depending on the
        input the returned similar faces list contains faceIds or
        persistedFaceIds ranked by similarity.
        <br/>Find similar has two working modes, "matchPerson" and "matchFace".
        "matchPerson" is the default mode that it tries to find faces of the
        same person as possible by using internal same-person thresholds. It is
        useful to find a known person's other photos. Note that an empty list
        will be returned if no faces pass the internal thresholds. "matchFace"
        mode ignores same-person thresholds and returns ranked similar faces
        anyway, even the similarity is low. It can be used in the cases like
        searching celebrity-looking faces.
        <br/>The 'recognitionModel' associated with the query face's faceId
        should be the same as the 'recognitionModel' used by the target faceId
        array, face list or large face list.
        .

        :param face_id: FaceId of the query face. User needs to call Face -
         Detect first to get a valid faceId. Note that this faceId is not
         persisted and will expire 24 hours after the detection call
        :type face_id: str
        :param face_list_id: An existing user-specified unique candidate face
         list, created in Face List - Create a Face List. Face list contains a
         set of persistedFaceIds which are persisted and will never expire.
         Parameter faceListId, largeFaceListId and faceIds should not be
         provided at the same time.
        :type face_list_id: str
        :param large_face_list_id: An existing user-specified unique candidate
         large face list, created in LargeFaceList - Create. Large face list
         contains a set of persistedFaceIds which are persisted and will never
         expire. Parameter faceListId, largeFaceListId and faceIds should not
         be provided at the same time.
        :type large_face_list_id: str
        :param face_ids: An array of candidate faceIds. All of them are
         created by Face - Detect and the faceIds will expire 24 hours after
         the detection call. The number of faceIds is limited to 1000.
         Parameter faceListId, largeFaceListId and faceIds should not be
         provided at the same time.
        :type face_ids: list[str]
        :param max_num_of_candidates_returned: The number of top similar faces
         returned. The valid range is [1, 1000].
        :type max_num_of_candidates_returned: int
        :param mode: Similar face searching mode. It can be "matchPerson" or
         "matchFace". Possible values include: 'matchPerson', 'matchFace'
        :type mode: str or
         ~azure.cognitiveservices.vision.face.models.FindSimilarMatchMode
        :param dict custom_headers: headers that will be added to the request
        :param bool raw: returns the direct response alongside the
         deserialized response
        :param operation_config: :ref:`Operation configuration
         overrides<msrest:optionsforoperations>`.
        :return: list or ClientRawResponse if raw=true
        :rtype: list[~azure.cognitiveservices.vision.face.models.SimilarFace]
         or ~msrest.pipeline.ClientRawResponse
        :raises:
         :class:`APIErrorException<azure.cognitiveservices.vision.face.models.APIErrorException>`
        """
        body = models.FindSimilarRequest(face_id=face_id, face_list_id=face_list_id, large_face_list_id=large_face_list_id, face_ids=face_ids, max_num_of_candidates_returned=max_num_of_candidates_returned, mode=mode)

        # Construct URL
        url = self.find_similar.metadata['url']
        path_format_arguments = {
            'Endpoint': self._serialize.url("self.config.endpoint", self.config.endpoint, 'str', skip_quote=True)
        }
        url = self._client.format_url(url, **path_format_arguments)

        # Construct parameters
        query_parameters = {}

        # Construct headers
        header_parameters = {}
        header_parameters['Accept'] = 'application/json'
        header_parameters['Content-Type'] = 'application/json; charset=utf-8'
        if custom_headers:
            header_parameters.update(custom_headers)

        # Construct body
        body_content = self._serialize.body(body, 'FindSimilarRequest')

        # Construct and send request
        request = self._client.post(url, query_parameters, header_parameters, body_content)
        response = self._client.send(request, stream=False, **operation_config)

        if response.status_code not in [200]:
            raise models.APIErrorException(self._deserialize, response)

        deserialized = None

        if response.status_code == 200:
            deserialized = self._deserialize('[SimilarFace]', response)

        if raw:
            client_raw_response = ClientRawResponse(deserialized, response)
            return client_raw_response

        return deserialized
Given query face's faceId, to search the similar-looking faces from a
        faceId array, a face list or a large face list. faceId array contains
        the faces created by [Face -
        Detect](/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f30395236),
        which will expire 24 hours after creation. A "faceListId" is created by
        [FaceList -
        Create](/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f3039524b)
        containing persistedFaceIds that will not expire. And a
        "largeFaceListId" is created by [LargeFaceList -
        Create](/docs/services/563879b61984550e40cbbe8d/operations/5a157b68d2de3616c086f2cc)
        containing persistedFaceIds that will also not expire. Depending on the
        input the returned similar faces list contains faceIds or
        persistedFaceIds ranked by similarity.
        <br/>Find similar has two working modes, "matchPerson" and "matchFace".
        "matchPerson" is the default mode that it tries to find faces of the
        same person as possible by using internal same-person thresholds. It is
        useful to find a known person's other photos. Note that an empty list
        will be returned if no faces pass the internal thresholds. "matchFace"
        mode ignores same-person thresholds and returns ranked similar faces
        anyway, even the similarity is low. It can be used in the cases like
        searching celebrity-looking faces.
        <br/>The 'recognitionModel' associated with the query face's faceId
        should be the same as the 'recognitionModel' used by the target faceId
        array, face list or large face list.
        .

        :param face_id: FaceId of the query face. User needs to call Face -
         Detect first to get a valid faceId. Note that this faceId is not
         persisted and will expire 24 hours after the detection call
        :type face_id: str
        :param face_list_id: An existing user-specified unique candidate face
         list, created in Face List - Create a Face List. Face list contains a
         set of persistedFaceIds which are persisted and will never expire.
         Parameter faceListId, largeFaceListId and faceIds should not be
         provided at the same time.
        :type face_list_id: str
        :param large_face_list_id: An existing user-specified unique candidate
         large face list, created in LargeFaceList - Create. Large face list
         contains a set of persistedFaceIds which are persisted and will never
         expire. Parameter faceListId, largeFaceListId and faceIds should not
         be provided at the same time.
        :type large_face_list_id: str
        :param face_ids: An array of candidate faceIds. All of them are
         created by Face - Detect and the faceIds will expire 24 hours after
         the detection call. The number of faceIds is limited to 1000.
         Parameter faceListId, largeFaceListId and faceIds should not be
         provided at the same time.
        :type face_ids: list[str]
        :param max_num_of_candidates_returned: The number of top similar faces
         returned. The valid range is [1, 1000].
        :type max_num_of_candidates_returned: int
        :param mode: Similar face searching mode. It can be "matchPerson" or
         "matchFace". Possible values include: 'matchPerson', 'matchFace'
        :type mode: str or
         ~azure.cognitiveservices.vision.face.models.FindSimilarMatchMode
        :param dict custom_headers: headers that will be added to the request
        :param bool raw: returns the direct response alongside the
         deserialized response
        :param operation_config: :ref:`Operation configuration
         overrides<msrest:optionsforoperations>`.
        :return: list or ClientRawResponse if raw=true
        :rtype: list[~azure.cognitiveservices.vision.face.models.SimilarFace]
         or ~msrest.pipeline.ClientRawResponse
        :raises:
         :class:`APIErrorException<azure.cognitiveservices.vision.face.models.APIErrorException>`