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

Error: Face.detect_with_stream() with list of return_face_attributes=[] #14163

Closed
ZLNjust opened this issue Oct 1, 2020 · 3 comments
Closed
Labels
Client This issue points to a problem in the data-plane of the library. Cognitive - Face customer-reported Issues that are reported by GitHub users external to the Azure organization. needs-author-feedback Workflow: More information is needed from author to address the issue. needs-team-attention Workflow: This issue needs attention from Azure service team or SDK team no-recent-activity There has been no recent activity on this issue. question The issue doesn't require a change to the product in order to be resolved. Most issues start as that Service Attention Workflow: This issue is responsible by Azure service team.

Comments

@ZLNjust
Copy link

ZLNjust commented Oct 1, 2020

  • Package Name:
    import asyncio
    import io
    import glob
    import os
    import sys
    import time
    import uuid
    import requests
    from urllib.parse import urlparse
    from io import BytesIO
    from PIL import Image, ImageDraw
    import pandas as pd
    from azure.cognitiveservices.vision.face import FaceClient

  • Package Version:

  • Operating System:
    Mac os

  • Python Version:
    Python 3.8

Here I tried to use local photo to do the emotion detection face_client.face.detect_with_stream
`
IMAGES_FOLDER='' # photo address

test_image_array = glob.glob(os.path.join(IMAGES_FOLDER, '*jpg'))

image = open(test_image_array[0], 'r+b')

faces = face_client.face.detect_with_stream(image)
`

But it is wrong

as shown:

---------------------------------------------------------------------------
OSError                                   Traceback (most recent call last)
~/.conda/envs/Emotion_Azure/lib/python3.8/site-packages/requests/adapters.py in send(self, request, stream, timeout, verify, cert, proxies)
    466 
--> 467                     low_conn.endheaders()
    468 

~/.conda/envs/Emotion_Azure/lib/python3.8/http/client.py in endheaders(self, message_body, encode_chunked)
   1249             raise CannotSendHeader()
-> 1250         self._send_output(message_body, encode_chunked=encode_chunked)
   1251 

~/.conda/envs/Emotion_Azure/lib/python3.8/http/client.py in _send_output(self, message_body, encode_chunked)
   1009         del self._buffer[:]
-> 1010         self.send(msg)
   1011 

~/.conda/envs/Emotion_Azure/lib/python3.8/http/client.py in send(self, data)
    949             if self.auto_open:
--> 950                 self.connect()
    951             else:

~/.conda/envs/Emotion_Azure/lib/python3.8/site-packages/urllib3/connection.py in connect(self)
    361 
--> 362         self.sock = ssl_wrap_socket(
    363             sock=conn,

~/.conda/envs/Emotion_Azure/lib/python3.8/site-packages/urllib3/util/ssl_.py in ssl_wrap_socket(sock, keyfile, certfile, cert_reqs, ca_certs, server_hostname, ssl_version, ciphers, ssl_context, ca_cert_dir, key_password, ca_cert_data)
    396 
--> 397     return context.wrap_socket(sock)
    398 

~/.conda/envs/Emotion_Azure/lib/python3.8/ssl.py in wrap_socket(self, sock, server_side, do_handshake_on_connect, suppress_ragged_eofs, server_hostname, session)
    499         # ctx._wrap_socket()
--> 500         return self.sslsocket_class._create(
    501             sock=sock,

~/.conda/envs/Emotion_Azure/lib/python3.8/ssl.py in _create(cls, sock, server_side, do_handshake_on_connect, suppress_ragged_eofs, server_hostname, context, session)
   1039                         raise ValueError("do_handshake_on_connect should not be specified for non-blocking sockets")
-> 1040                     self.do_handshake()
   1041             except (OSError, ValueError):

~/.conda/envs/Emotion_Azure/lib/python3.8/ssl.py in do_handshake(self, block)
   1308                 self.settimeout(None)
-> 1309             self._sslobj.do_handshake()
   1310         finally:

OSError: [Errno 0] Error

During handling of the above exception, another exception occurred:

ConnectionError                           Traceback (most recent call last)
~/.conda/envs/Emotion_Azure/lib/python3.8/site-packages/msrest/universal_http/requests.py in send(self, request, **kwargs)
    138         try:
--> 139             response = session.request(
    140                 request.method,

~/.conda/envs/Emotion_Azure/lib/python3.8/site-packages/requests/sessions.py in request(self, method, url, params, data, headers, cookies, files, auth, timeout, allow_redirects, proxies, hooks, stream, verify, cert, json)
    529         send_kwargs.update(settings)
--> 530         resp = self.send(prep, **send_kwargs)
    531 

~/.conda/envs/Emotion_Azure/lib/python3.8/site-packages/requests/sessions.py in send(self, request, **kwargs)
    642         # Send the request
--> 643         r = adapter.send(request, **kwargs)
    644 

~/.conda/envs/Emotion_Azure/lib/python3.8/site-packages/requests/adapters.py in send(self, request, stream, timeout, verify, cert, proxies)
    497         except (ProtocolError, socket.error) as err:
--> 498             raise ConnectionError(err, request=request)
    499 

ConnectionError: [Errno 0] Error

During handling of the above exception, another exception occurred:

ClientRequestError                        Traceback (most recent call last)
<ipython-input-15-122d5fe49d09> in <module>
----> 1 faces = face_client.face.detect_with_stream(image)

~/.conda/envs/Emotion_Azure/lib/python3.8/site-packages/azure/cognitiveservices/vision/face/operations/_face_operations.py in detect_with_stream(self, image, return_face_id, return_face_landmarks, return_face_attributes, recognition_model, return_recognition_model, detection_model, custom_headers, raw, callback, **operation_config)
    786         # Construct and send request
    787         request = self._client.post(url, query_parameters, header_parameters, body_content)
--> 788         response = self._client.send(request, stream=False, **operation_config)
    789 
    790         if response.status_code not in [200]:

~/.conda/envs/Emotion_Azure/lib/python3.8/site-packages/msrest/service_client.py in send(self, request, headers, content, **kwargs)
    334         kwargs.setdefault('stream', True)
    335         try:
--> 336             pipeline_response = self.config.pipeline.run(request, **kwargs)
    337             # There is too much thing that expects this method to return a "requests.Response"
    338             # to break it in a compatible release.

~/.conda/envs/Emotion_Azure/lib/python3.8/site-packages/msrest/pipeline/__init__.py in run(self, request, **kwargs)
    195         pipeline_request = Request(request, context)  # type: Request[HTTPRequestType]
    196         first_node = self._impl_policies[0] if self._impl_policies else self._sender
--> 197         return first_node.send(pipeline_request, **kwargs)  # type: ignore
    198 
    199 class HTTPSender(AbstractContextManager, ABC, Generic[HTTPRequestType, HTTPResponseType]):

~/.conda/envs/Emotion_Azure/lib/python3.8/site-packages/msrest/pipeline/__init__.py in send(self, request, **kwargs)
    148         self._policy.on_request(request, **kwargs)
    149         try:
--> 150             response = self.next.send(request, **kwargs)
    151         except Exception:
    152             if not self._policy.on_exception(request, **kwargs):

~/.conda/envs/Emotion_Azure/lib/python3.8/site-packages/msrest/pipeline/requests.py in send(self, request, **kwargs)
     70         try:
     71             try:
---> 72                 return self.next.send(request, **kwargs)
     73             except (oauth2.rfc6749.errors.InvalidGrantError,
     74                     oauth2.rfc6749.errors.TokenExpiredError) as err:

~/.conda/envs/Emotion_Azure/lib/python3.8/site-packages/msrest/pipeline/requests.py in send(self, request, **kwargs)
    135 
    136         try:
--> 137             return self.next.send(request, **kwargs)
    138         finally:
    139             if old_max_redirects:

~/.conda/envs/Emotion_Azure/lib/python3.8/site-packages/msrest/pipeline/__init__.py in send(self, request, **kwargs)
    148         self._policy.on_request(request, **kwargs)
    149         try:
--> 150             response = self.next.send(request, **kwargs)
    151         except Exception:
    152             if not self._policy.on_exception(request, **kwargs):

~/.conda/envs/Emotion_Azure/lib/python3.8/site-packages/msrest/pipeline/requests.py in send(self, request, **kwargs)
    191         return Response(
    192             request,
--> 193             self.driver.send(request.http_request, **kwargs)
    194         )

~/.conda/envs/Emotion_Azure/lib/python3.8/site-packages/msrest/universal_http/requests.py in send(self, request, **kwargs)
    331         """
    332         requests_kwargs = self._configure_send(request, **kwargs)
--> 333         return super(RequestsHTTPSender, self).send(request, **requests_kwargs)
    334 
    335 

~/.conda/envs/Emotion_Azure/lib/python3.8/site-packages/msrest/universal_http/requests.py in send(self, request, **kwargs)
    143         except requests.RequestException as err:
    144             msg = "Error occurred in request."
--> 145             raise_with_traceback(ClientRequestError, msg, err)
    146 
    147         return RequestsClientResponse(request, response)

~/.conda/envs/Emotion_Azure/lib/python3.8/site-packages/msrest/exceptions.py in raise_with_traceback(exception, message, *args, **kwargs)
     49     error = exception(exc_msg, *args, **kwargs)
     50     try:
---> 51         raise error.with_traceback(exc_traceback)
     52     except AttributeError:
     53         error.__traceback__ = exc_traceback

~/.conda/envs/Emotion_Azure/lib/python3.8/site-packages/msrest/universal_http/requests.py in send(self, request, **kwargs)
    137         session = kwargs.pop('session', self.session)
    138         try:
--> 139             response = session.request(
    140                 request.method,
    141                 request.url,

~/.conda/envs/Emotion_Azure/lib/python3.8/site-packages/requests/sessions.py in request(self, method, url, params, data, headers, cookies, files, auth, timeout, allow_redirects, proxies, hooks, stream, verify, cert, json)
    528         }
    529         send_kwargs.update(settings)
--> 530         resp = self.send(prep, **send_kwargs)
    531 
    532         return resp

~/.conda/envs/Emotion_Azure/lib/python3.8/site-packages/requests/sessions.py in send(self, request, **kwargs)
    641 
    642         # Send the request
--> 643         r = adapter.send(request, **kwargs)
    644 
    645         # Total elapsed time of the request (approximately)

~/.conda/envs/Emotion_Azure/lib/python3.8/site-packages/requests/adapters.py in send(self, request, stream, timeout, verify, cert, proxies)
    496 
    497         except (ProtocolError, socket.error) as err:
--> 498             raise ConnectionError(err, request=request)
    499 
    500         except MaxRetryError as e:

ClientRequestError: Error occurred in request., ConnectionError: [Errno 0] Error

Did I miss something or make a mistake?

@ghost ghost added needs-triage Workflow: This is a new issue that needs to be triaged to the appropriate team. customer-reported Issues that are reported by GitHub users external to the Azure organization. question The issue doesn't require a change to the product in order to be resolved. Most issues start as that labels Oct 1, 2020
@kaerm kaerm added Client This issue points to a problem in the data-plane of the library. Cognitive - Face Service Attention Workflow: This issue is responsible by Azure service team. labels Oct 1, 2020
@ghost ghost removed the needs-triage Workflow: This is a new issue that needs to be triaged to the appropriate team. label Oct 1, 2020
@ghost
Copy link

ghost commented Oct 1, 2020

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @JinyuID, @dipidoo, @SteveMSFT.

@azure-sdk azure-sdk added the needs-team-attention Workflow: This issue needs attention from Azure service team or SDK team label Jan 5, 2021
openapi-sdkautomation bot pushed a commit to AzureSDKAutomation/azure-sdk-for-python that referenced this issue May 14, 2021
machinelearningcompute wave4 modification (Azure#14163)

* machinelearningcompute wave4 modification

* machinelearningcompute wave4

* only track2

* 1.0.0b1

Co-authored-by: Yan Zhang (WICRESOFT NORTH AMERICA LTD) <v-yanzhang@microsoft.com>
msyyc pushed a commit that referenced this issue May 18, 2021
* CodeGen from PR 14163 in Azure/azure-rest-api-specs
machinelearningcompute wave4 modification (#14163)

* machinelearningcompute wave4 modification

* machinelearningcompute wave4

* only track2

* 1.0.0b1

Co-authored-by: Yan Zhang (WICRESOFT NORTH AMERICA LTD) <v-yanzhang@microsoft.com>

* version,CHANGELOG

* Update shared_requirements.txt

* t2 config

Co-authored-by: SDKAuto <sdkautomation@microsoft.com>
Co-authored-by: Yan Zhang (WICRESOFT NORTH AMERICA LTD) <v-yanzhang@microsoft.com>
Co-authored-by: PythonSdkPipelines <PythonSdkPipelines>
Co-authored-by: Zed Lei <59104634+RAY-316@users.noreply.github.com>
Co-authored-by: Zed <601306339@qq.com>
@Karishma-Tiwari-MSFT
Copy link

@ZLNjust Looks like this issue was resolved with the PR above. Please let me know if you are still seeing this issue. Thanks.

@Karishma-Tiwari-MSFT Karishma-Tiwari-MSFT added the needs-author-feedback Workflow: More information is needed from author to address the issue. label Oct 26, 2021
@ghost ghost added the no-recent-activity There has been no recent activity on this issue. label Nov 3, 2021
@ghost
Copy link

ghost commented Nov 3, 2021

Hi, we're sending this friendly reminder because we haven't heard back from you in a while. We need more information about this issue to help address it. Please be sure to give us your input within the next 7 days. If we don't hear back from you within 14 days of this comment the issue will be automatically closed. Thank you!

@ghost ghost closed this as completed Nov 17, 2021
@github-actions github-actions bot locked and limited conversation to collaborators Apr 12, 2023
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Client This issue points to a problem in the data-plane of the library. Cognitive - Face customer-reported Issues that are reported by GitHub users external to the Azure organization. needs-author-feedback Workflow: More information is needed from author to address the issue. needs-team-attention Workflow: This issue needs attention from Azure service team or SDK team no-recent-activity There has been no recent activity on this issue. question The issue doesn't require a change to the product in order to be resolved. Most issues start as that Service Attention Workflow: This issue is responsible by Azure service team.
Projects
None yet
Development

No branches or pull requests

4 participants