Skip to content

Conversation

@der3318
Copy link
Member

@der3318 der3318 commented Jul 18, 2024

Purpose

The PR rewrites all the face sample codes that are referenced by learn.microsoft.com. The primary goal is to migrate to the newly released SDKs:

Language Deprecated SDK New SDK
C# Microsoft.Azure.CognitiveServices.Vision.Face Azure.AI.Vision.Face
Python azure-cognitiveservices-vision-face azure.ai.vision.face
JavaScript @azure/cognitiveservices-face @azure-rest/ai-vision-face

Note

Some of the operations (e.g., collection management) are not fully supported by the current version of FaceClient. For those cases, we fallback to raw REST APIs invoked via HttpClient (C#) and module requests (Python).

File Rewritten Based on Referenced by
dotnet/Face/Quickstart.cs FaceQuickstart-single.cs identity-csharp-sdk.md
dotnet/Face/Detect.cs detect.cs identity-detect-faces.md
dotnet/Face/FindSimilar.cs FaceQuickstart.cs find-similar-faces.md
python/Face/Quickstart.py FaceQuickstart-single.py identity-python-sdk.md
javascript/Face/Quickstart.js sdk_quickstart_cognitiveservices-face.js identity-javascript-sdk.md

There're also some minor fixes and unification between languages:

  • Unify the image quality criteria. Only "high QualityForRecognition" faces can be enrolled, and only "high/medium QualityForRecognition" can be used to test a match.
  • Ensure there's exactly one face in the enrollment image.
  • Demonstrate the use of large person group instead of normal person group.
  • Add a delay and reduce the image counts to make the sample compatible with F0 tiers:
Console.WriteLine("Pausing for 60 seconds to avoid triggering rate limit on free account...");
await Task.Delay(60000);

Does this introduce a breaking change?

  • Yes
  • No

Pull Request Type

What kind of change does this Pull Request introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Documentation content changes
  • Other... Please describe:

How to Test

Visual Studio 2022 | .NET 8.0 (LTS)

$ dotnet run

Python 3.8.9

$ python Quickstart.py

OpenJS.NodeJS.LTS (Version 20.15.0)

$ node Quickstart.js

Other Information

Related changes but are covered by the PR:

Here are the planned TODOs:

  • Draft a PR against MicrosoftDocs/azure-docs-pr to update links, reflect the changes and modify other embedded snippets hosted on learn.microsoft.com site.
  • Cleanup legacy stuff in this repo. For example, moving all the non applicable samples into a subfolder named "cognsvcsdk".
  • Reach out to Vision Studio and Azure AI Studio so the links to SDKs/docs/samples can be refreshed as well.

@der3318
Copy link
Member Author

der3318 commented Jul 18, 2024

@PatrickFarley , please help check the new samples in. I will continue to work on docs changes and create another PR in repo azure-docs-pr for you to have a comprehensive review. Thanks!

@PatrickFarley PatrickFarley merged commit 67e2048 into Azure-Samples:master Jul 22, 2024
@der3318 der3318 mentioned this pull request Jul 23, 2024
8 tasks
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

Successfully merging this pull request may close these issues.

2 participants