Skip to content

Commit f0f16da

Browse files
authored
Merge pull request #283726 from MicrosoftDocs/main
8/6/2024 AM Publish
2 parents 0e903b5 + f531b46 commit f0f16da

File tree

315 files changed

+20413
-32500
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

315 files changed

+20413
-32500
lines changed
Lines changed: 167 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,167 @@
1+
---
2+
title: "Face Java client library quickstart"
3+
description: Use the Face client library for Java to detect faces and identify faces (facial recognition search).
4+
#services: cognitive-services
5+
author: PatrickFarley
6+
manager: nitinme
7+
ms.service: azure-ai-vision
8+
ms.subservice: azure-ai-face
9+
ms.custom:
10+
- ignite-2023
11+
ms.topic: include
12+
ms.date: 08/08/2024
13+
ms.author: pafarley
14+
---
15+
16+
Get started with facial recognition using the Face client library for Java. Follow these steps to install the package and try out the example code for basic tasks. The Face service provides you with access to advanced algorithms for detecting and recognizing human faces in images. Follow these steps to install the package and try out the example code for basic face identification using remote images.
17+
18+
[Reference documentation](https://aka.ms/azsdk-java-face-ref) | [Library source code](https://github.com/Azure/azure-sdk-for-java/tree/main/sdk/face/azure-ai-vision-face) | [Package (Maven)](https://central.sonatype.com/artifact/com.azure/azure-ai-vision-face) | [Samples](https://github.com/Azure/azure-sdk-for-java/tree/main/sdk/face/azure-ai-vision-face/src/samples)
19+
20+
## Prerequisites
21+
22+
* Azure subscription - [Create one for free](https://azure.microsoft.com/free/cognitive-services/)
23+
* The current version of the [Java Development Kit (JDK)](https://www.microsoft.com/openjdk)
24+
* [Apache Maven](https://maven.apache.org/download.cgi) installed. On Linux, install from the distribution repositories if available.
25+
* Once you have your Azure subscription, <a href="https://portal.azure.com/#create/Microsoft.CognitiveServicesFace" title="Create a Face resource" target="_blank">create a Face resource</a> in the Azure portal to get your key and endpoint. After it deploys, select **Go to resource**.
26+
* You'll need the key and endpoint from the resource you create to connect your application to the Face API.
27+
* You can use the free pricing tier (`F0`) to try the service, and upgrade later to a paid tier for production.
28+
29+
30+
## Create environment variables
31+
32+
[!INCLUDE [create environment variables](../face-environment-variables.md)]
33+
34+
## Identify and verify faces
35+
36+
1. Install the client library
37+
38+
Open a console window and create a new folder for your quickstart application. Copy the following content to a new file. Save the file as `pom.xml` in your project directory:
39+
40+
<!-- [!INCLUDE][](https://raw.githubusercontent.com/Azure-Samples/cognitive-services-quickstart-code/master/java/Face/pom.xml)] -->
41+
```xml
42+
<project xmlns="http://maven.apache.org/POM/4.0.0"
43+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
44+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
45+
<modelVersion>4.0.0</modelVersion>
46+
<groupId>com.example</groupId>
47+
<artifactId>my-application-name</artifactId>
48+
<version>1.0.0</version>
49+
<dependencies>
50+
<!-- https://mvnrepository.com/artifact/com.azure/azure-ai-vision-face -->
51+
<dependency>
52+
<groupId>com.azure</groupId>
53+
<artifactId>azure-ai-vision-face</artifactId>
54+
<version>1.0.0-beta.1</version>
55+
</dependency>
56+
<!-- https://mvnrepository.com/artifact/org.apache.httpcomponents/httpclient -->
57+
<dependency>
58+
<groupId>org.apache.httpcomponents</groupId>
59+
<artifactId>httpclient</artifactId>
60+
<version>4.5.13</version>
61+
</dependency>
62+
<!-- https://mvnrepository.com/artifact/com.google.code.gson/gson -->
63+
<dependency>
64+
<groupId>com.google.code.gson</groupId>
65+
<artifactId>gson</artifactId>
66+
<version>2.11.0</version>
67+
</dependency>
68+
</dependencies>
69+
</project>
70+
```
71+
72+
Install the SDK and dependencies by running the following in the project directory:
73+
74+
```console
75+
mvn clean dependency:copy-dependencies
76+
```
77+
78+
1. Create a new Java application
79+
80+
Create a file named `Quickstart.java`, open it in a text editor, and paste in the following code:
81+
82+
> [!NOTE]
83+
> If you haven't received access to the Face service using the [intake form](https://aka.ms/facerecognition), some of these functions won't work.
84+
85+
[!code-java[](~/cognitive-services-quickstart-code/java/Face/Quickstart.java?name=snippet_single)]
86+
87+
88+
1. Run your face recognition app from the application directory with the `javac` and `java` commands.
89+
90+
#### [Windows](#tab/windows)
91+
92+
```console
93+
javac -cp target\dependency\* Quickstart.java
94+
java -cp .;target\dependency\* Quickstart
95+
```
96+
97+
#### [Linux](#tab/linux)
98+
99+
```console
100+
javac -cp target/dependency/* Quickstart.java
101+
java -cp .:target/dependency/* Quickstart
102+
```
103+
104+
---
105+
106+
107+
108+
## Output
109+
110+
```console
111+
========IDENTIFY FACES========
112+
113+
Create a person group (3761e61a-16b2-4503-ad29-ed34c58ba676).
114+
Create a person group person 'Family1-Dad'.
115+
Check whether image is of sufficient quality for recognition
116+
Add face to the person group person(Family1-Dad) from image `Family1-Dad1.jpg`
117+
Check whether image is of sufficient quality for recognition
118+
Add face to the person group person(Family1-Dad) from image `Family1-Dad2.jpg`
119+
Create a person group person 'Family1-Mom'.
120+
Check whether image is of sufficient quality for recognition
121+
Add face to the person group person(Family1-Mom) from image `Family1-Mom1.jpg`
122+
Check whether image is of sufficient quality for recognition
123+
Add face to the person group person(Family1-Mom) from image `Family1-Mom2.jpg`
124+
Create a person group person 'Family1-Son'.
125+
Check whether image is of sufficient quality for recognition
126+
Add face to the person group person(Family1-Son) from image `Family1-Son1.jpg`
127+
Check whether image is of sufficient quality for recognition
128+
Add face to the person group person(Family1-Son) from image `Family1-Son2.jpg`
129+
130+
Train person group 3761e61a-16b2-4503-ad29-ed34c58ba676.
131+
Training status: succeeded.
132+
133+
Pausing for 60 seconds to avoid triggering rate limit on free account...
134+
4 face(s) with 4 having sufficient quality for recognition.
135+
Person 'Family1-Dad' is identified for the face in: identification1.jpg - d7995b34-1b72-47fe-82b6-e9877ed2578d, confidence: 0.96807.
136+
Verification result: is a match? true. confidence: 0.96807
137+
Person 'Family1-Mom' is identified for the face in: identification1.jpg - 844da0ed-4890-4bbf-a531-e638797f96fc, confidence: 0.96902.
138+
Verification result: is a match? true. confidence: 0.96902
139+
No person is identified for the face in: identification1.jpg - c543159a-57f3-4872-83ce-2d4a733d71c9.
140+
Person 'Family1-Son' is identified for the face in: identification1.jpg - 414fac6c-7381-4dba-9c8b-fd26d52e879b, confidence: 0.9281.
141+
Verification result: is a match? true. confidence: 0.9281
142+
143+
========DELETE PERSON GROUP========
144+
145+
Deleted the person group 3761e61a-16b2-4503-ad29-ed34c58ba676.
146+
147+
End of quickstart.
148+
```
149+
150+
151+
152+
## Clean up resources
153+
154+
If you want to clean up and remove an Azure AI services subscription, you can delete the resource or resource group. Deleting the resource group also deletes any other resources associated with it.
155+
156+
* [Azure portal](../../../multi-service-resource.md?pivots=azportal#clean-up-resources)
157+
* [Azure CLI](../../../multi-service-resource.md?pivots=azcli#clean-up-resources)
158+
159+
## Next steps
160+
161+
In this quickstart, you learned how to use the Face client library for Java to do basic face identification. Next, learn about the different face detection models and how to specify the right model for your use case.
162+
163+
> [!div class="nextstepaction"]
164+
> [Specify a face detection model version](../../how-to/specify-detection-model.md)
165+
166+
* [What is the Face service?](../../overview-identity.md)
167+
* More extensive sample code can be found on [GitHub](https://aka.ms/FaceSamples).

articles/ai-services/computer-vision/quickstarts-sdk/identity-client-library.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,11 @@ keywords: face search by image, facial recognition search, facial recognition, f
3535

3636
::: zone-end
3737

38+
::: zone pivot="programming-language-java"
39+
40+
[!INCLUDE [Java quickstart](../includes/quickstarts-sdk/identity-java-sdk.md)]
41+
42+
::: zone-end
3843

3944
::: zone pivot="programming-language-javascript"
4045

articles/ai-services/content-safety/how-to/encrypt-data-at-rest.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,10 @@ Azure AI Content Safety automatically encrypts your data when it's persisted to
2020

2121
Azure AI Content Safety is part of Azure AI services. Azure AI services data is encrypted and decrypted using [FIPS 140-2](https://en.wikipedia.org/wiki/FIPS_140-2) compliant [256-bit AES](https://en.wikipedia.org/wiki/Advanced_Encryption_Standard) encryption. Encryption and decryption are transparent, meaning encryption and access are managed for you. Your data is secure by default and you don't need to modify your code or applications to take advantage of encryption.
2222

23-
2423
## About encryption key management
2524

2625
By default, your subscription uses Microsoft-managed encryption keys. There's also the option to manage your subscription with your own keys called customer-managed keys (CMK). CMK offers greater flexibility to create, rotate, disable, and revoke access controls. You can also audit the encryption keys used to protect your data.
2726

28-
> [!IMPORTANT]
29-
> For blocklist names, only MMK encryption is applied by default. Using CMK or not will not change this behavior. All the other data will use either MMK or CMK depending on what you've selected.
30-
3127
## Customer-managed keys with Azure Key Vault
3228

3329
Customer-managed keys (CMK), also known as Bring your own key (BYOK), offer greater flexibility to create, rotate, disable, and revoke access controls. You can also audit the encryption keys used to protect your data.

articles/ai-services/openai/how-to/gpt-with-vision.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ The _detail_ parameter in the model offers three choices: `low`, `high`, or `aut
247247
- `low` setting: the model does not activate the "high res" mode, instead processes a lower resolution 512x512 version, resulting in quicker responses and reduced token consumption for scenarios where fine detail isn't crucial.
248248
- `high` setting: the model activates "high res" mode. Here, the model initially views the low-resolution image and then generates detailed 512x512 segments from the input image. Each segment uses double the token budget, allowing for a more detailed interpretation of the image.''
249249

250-
For details on how the image parameters impact tokens used and pricing please see - [What is OpenAI? Image Tokens with GPT-4 Turbo with Vision](../overview.md#image-tokens-gpt-4-turbo-with-vision)
250+
For details on how the image parameters impact tokens used and pricing please see - [What is OpenAI? Image Tokens with GPT-4 Turbo with Vision](../overview.md#image-tokens-gpt-4-turbo-with-vision-and-gpt-4o)
251251

252252
## Use Vision enhancement with images
253253

articles/ai-services/openai/includes/batch/batch-python.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ Like [fine-tuning](../../how-to/fine-tuning.md), global batch uses files in JSON
5252
### Input with image url
5353

5454
```json
55-
{"custom_id": "request-1", "method": "POST", "url": "/chat/completions", "body": {"model": "REPLACE-WITH-MODEL-DEPLOYMENT-NAME", "messages": [{"role": "system", "content": "You are a helpful assistant."},{"role": "user", "content": [{"type": "text", "text": "What’s in this image?"},{"type": "image_url","image_url": {"url": "https://upload.wikimedia.org/wikipedia/commons/thumb/d/dd/Gfp-wisconsin-madison-the-nature-boardwalk.jpg/2560px-Gfp-wisconsin-madison-the-nature-boardwalk.jpg"}}]}],"max_tokens": 1000}}
55+
{"custom_id": "request-1", "method": "POST", "url": "/chat/completions", "body": {"model": "REPLACE-WITH-MODEL-DEPLOYMENT-NAME", "messages": [{"role": "system", "content": "You are a helpful assistant."},{"role": "user", "content": [{"type": "text", "text": "What’s in this image?"},{"type": "image_url","image_url": {"url": "https://raw.githubusercontent.com/MicrosoftDocs/azure-docs/main/articles/ai-services/openai/media/how-to/generated-seattle.png"}}]}],"max_tokens": 1000}}
5656
```
5757

5858
---
@@ -266,7 +266,7 @@ Observe that there's both `error_file_id` and a separate `output_file_id`. Use t
266266
```python
267267
import json
268268

269-
response = client.files.content(batch_response.output_file_id)
269+
file_response = client.files.content(batch_response.output_file_id)
270270
raw_responses = file_response.text.strip().split('\n')
271271

272272
for raw_response in raw_responses:

articles/ai-services/openai/includes/batch/batch-rest.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ Like [fine-tuning](../../how-to/fine-tuning.md), global batch uses files in JSON
4141
### Input with image url
4242

4343
```json
44-
{"custom_id": "request-1", "method": "POST", "url": "/chat/completions", "body": {"model": "REPLACE-WITH-MODEL-DEPLOYMENT-NAME", "messages": [{"role": "system", "content": "You are a helpful assistant."},{"role": "user", "content": [{"type": "text", "text": "What’s in this image?"},{"type": "image_url","image_url": {"url": "https://upload.wikimedia.org/wikipedia/commons/thumb/d/dd/Gfp-wisconsin-madison-the-nature-boardwalk.jpg/2560px-Gfp-wisconsin-madison-the-nature-boardwalk.jpg"}}]}],"max_tokens": 1000}}
44+
{"custom_id": "request-1", "method": "POST", "url": "/chat/completions", "body": {"model": "REPLACE-WITH-MODEL-DEPLOYMENT-NAME", "messages": [{"role": "system", "content": "You are a helpful assistant."},{"role": "user", "content": [{"type": "text", "text": "What’s in this image?"},{"type": "image_url","image_url": {"url": "https://raw.githubusercontent.com/MicrosoftDocs/azure-docs/main/articles/ai-services/openai/media/how-to/generated-seattle.png"}}]}],"max_tokens": 1000}}
4545
```
4646

4747
---

articles/ai-services/openai/includes/batch/batch-studio.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ Like [fine-tuning](../../how-to/fine-tuning.md), global batch uses files in JSON
4141
### Input with image url
4242

4343
```json
44-
{"custom_id": "request-1", "method": "POST", "url": "/chat/completions", "body": {"model": "REPLACE-WITH-MODEL-DEPLOYMENT-NAME", "messages": [{"role": "system", "content": "You are a helpful assistant."},{"role": "user", "content": [{"type": "text", "text": "What’s in this image?"},{"type": "image_url","image_url": {"url": "https://upload.wikimedia.org/wikipedia/commons/thumb/d/dd/Gfp-wisconsin-madison-the-nature-boardwalk.jpg/2560px-Gfp-wisconsin-madison-the-nature-boardwalk.jpg"}}]}],"max_tokens": 1000}}
44+
{"custom_id": "request-1", "method": "POST", "url": "/chat/completions", "body": {"model": "REPLACE-WITH-MODEL-DEPLOYMENT-NAME", "messages": [{"role": "system", "content": "You are a helpful assistant."},{"role": "user", "content": [{"type": "text", "text": "What’s in this image?"},{"type": "image_url","image_url": {"url": "https://raw.githubusercontent.com/MicrosoftDocs/azure-docs/main/articles/ai-services/openai/media/how-to/generated-seattle.png"}}]}],"max_tokens": 1000}}
4545
```
4646

4747
---
@@ -70,13 +70,13 @@ Once your input file is prepared, you first need to upload the file to then be a
7070

7171
## Create batch job
7272

73-
Choose your global batch deployment name from the dropdown and select **Create**. The deployment should match the deployment name specified on each line of your `.jsonl` file.
73+
Select **Create** to start your batch job.
7474

7575
:::image type="content" source="../../media/how-to/global-batch/deployment.png" alt-text="Screenshot of the create a batch job Azure Studio UI experience." lightbox="../../media/how-to/global-batch/deployment.png":::
7676

7777
## Track batch job progress
7878

79-
Once your job is created, you can monitor the job's progress by selecting the Job ID for the most recently created job.
79+
Once your job is created, you can monitor the job's progress by selecting the Job ID for the most recently created job. By default you will be taken to the status page for your most recently created batch job.
8080

8181
:::image type="content" source="../../media/how-to/global-batch/job-id.png" alt-text="Screenshot that shows the batch job ID for a job currently undergoing validation." lightbox="../../media/how-to/global-batch/job-id.png":::
8282

@@ -86,7 +86,7 @@ You can track job status for your job in the right-hand pane:
8686

8787
## Retrieve batch job output file
8888

89-
Once your job has completed or reached a terminal state, it will generate two output files: `error.txt` and `output.txt` which can be downloaded for review by clicking the downward arrow icon.
89+
Once your job has completed or reached a terminal state, it will generate an error file and an output file which can be downloaded for review by selecting the respective button with the downward arrow icon.
9090

9191
:::image type="content" source="../../media/how-to/global-batch/output.png" alt-text="Screenshot that shows the batch job output and error files available for download." lightbox="../../media/how-to/global-batch/output.png":::
9292

-1 KB
Loading
-3.06 KB
Loading
-190 Bytes
Loading

0 commit comments

Comments
 (0)