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

How to unpack detect_with_stream #11202

Closed
kalaschnik opened this issue May 3, 2020 · 2 comments
Closed

How to unpack detect_with_stream #11202

kalaschnik opened this issue May 3, 2020 · 2 comments
Assignees
Labels
Client This issue points to a problem in the data-plane of the library. Cognitive - Face question The issue doesn't require a change to the product in order to be resolved. Most issues start as that

Comments

@kalaschnik
Copy link

How can I print the contents of my response from detect_with_stream, in this case the emotion attribute?

detected_faces_details = face_client.face.detect_with_stream(
  open((os.path.join("img/test-faces.jpg")),'r+b'),
  return_face_attributes=['emotion'])

detected_faces_details is only printing my two faces in test-faces.jpg in this manner:

[<azure.cognitiveservices.vision.face.models._models_py3.DetectedFace at 0x1e20ec06648>,
 <azure.cognitiveservices.vision.face.models._models_py3.DetectedFace at 0x1e20ec063c8>]
@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 May 3, 2020
@kristapratico
Copy link
Member

Hi @kalaschnik

detect_with_stream is returning a list of DetectedFace objects. Here is documentation that shows what a DetectedFace looks like.

If you want to print the emotion attribute for each face you can do this:

for face in detected_faces_details:
    print(face.face_attributes.emotion.anger)  # printing confidence value for anger, for example

Here are the available attributes found on the emotion object.

Let me know if this helps or if I misunderstood your question.

@kristapratico kristapratico added Cognitive Services needs-author-feedback Workflow: More information is needed from author to address the issue. and removed customer-reported Issues that are reported by GitHub users external to the Azure organization. needs-triage Workflow: This is a new issue that needs to be triaged to the appropriate team. labels May 4, 2020
@kristapratico kristapratico self-assigned this May 4, 2020
@kalaschnik
Copy link
Author

Hey @kristapratico

thank you for the syntax example, I was desperately looking for it 🙂
I was also not aware of this particular documentation site. I was digging through the docs here and here without finding examples for my case.

Anyway, the docs you posted look more fun to read than the others, although it lacks examples (like the one you give to me)—maybe it would be good add some examples?

Thanks!

@ghost ghost added needs-team-attention Workflow: This issue needs attention from Azure service team or SDK team and removed needs-author-feedback Workflow: More information is needed from author to address the issue. labels May 4, 2020
@kaerm kaerm added Cognitive - Face Client This issue points to a problem in the data-plane of the library. and removed Cognitive Services needs-team-attention Workflow: This issue needs attention from Azure service team or SDK team labels Jun 24, 2020
openapi-sdkautomation bot pushed a commit to AzureSDKAutomation/azure-sdk-for-python that referenced this issue Jan 14, 2021
openapi-sdkautomation bot pushed a commit to AzureSDKAutomation/azure-sdk-for-python that referenced this issue Jan 14, 2021
00Kai0 added a commit that referenced this issue Jan 20, 2021
* CodeGen from PR 11202 in Azure/azure-rest-api-specs
DiskRP Swagger for 09/30 (#11202)

* test,version,CHANGELOG

* fix test

* fix version and changelog

Co-authored-by: SDKAuto <sdkautomation@microsoft.com>
@github-actions github-actions bot locked and limited conversation to collaborators Apr 12, 2023
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 question The issue doesn't require a change to the product in order to be resolved. Most issues start as that
Projects
None yet
Development

No branches or pull requests

3 participants