You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/applied-ai-services/form-recognizer/concept-custom.md
+11-9Lines changed: 11 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -23,7 +23,9 @@ Custom models can be one of two types, [**custom template**](concept-custom-temp
23
23
24
24
### Custom template model
25
25
26
-
The custom template or custom form model relies on a consistent visual template to extract the labeled data. The accuracy of your model is affected by variances in the visual structure of your documents. Structured forms such as questionnaires or applications are examples of consistent visual templates. Your training set will consist of structured documents where the formatting and layout are static and constant from one document instance to the next. Custom template models support key-value pairs, selection marks, tables, signature fields and regions and can be trained on documents in any of the [supported languages](language-support.md). For more information, *see*[custom template models](concept-custom-template.md).
26
+
The custom template or custom form model relies on a consistent visual template to extract the labeled data. The accuracy of your model is affected by variances in the visual structure of your documents. Structured forms such as questionnaires or applications are examples of consistent visual templates.
27
+
28
+
Your training set will consist of structured documents where the formatting and layout are static and constant from one document instance to the next. Custom template models support key-value pairs, selection marks, tables, signature fields, and regions. Template models and can be trained on documents in any of the [supported languages](language-support.md). For more information, *see*[custom template models](concept-custom-template.md).
27
29
28
30
> [!TIP]
29
31
>
@@ -33,15 +35,15 @@ Custom models can be one of two types, [**custom template**](concept-custom-temp
33
35
34
36
### Custom neural model
35
37
36
-
The custom neural (custom document) model is a deep learning model type that relies on a base model trained on a large collection of documents. This model is then fine-tuned or adapted to your data when you train the model with a labeled dataset. Custom neural models support structured, semi-structured, and unstructured documents to extract fields. Custom neural models currently support English-language documents. When you're choosing between the two model types, start with a neural model if it meets your functional needs. See [neural models](concept-custom-neural.md) to learn more about custom document models.
38
+
The custom neural (custom document) model uses deep learning models and base model trained on a large collection of documents. This model is then fine-tuned or adapted to your data when you train the model with a labeled dataset. Custom neural models support structured, semi-structured, and unstructured documents to extract fields. Custom neural models currently support English-language documents. When you're choosing between the two model types, start with a neural model if it meets your functional needs. See [neural models](concept-custom-neural.md) to learn more about custom document models.
37
39
38
40
## Build mode
39
41
40
42
The build custom model operation has added support for the *template* and *neural* custom models. Previous versions of the REST API and SDKs only supported a single build mode that is now known as the *template* mode.
41
43
42
44
* Template models only accept documents that have the same basic page structure—a uniform visual appearance—or the same relative positioning of elements within the document.
43
45
44
-
* Neural models support documents that have the same information, but different page structures. Examples of these documents include United States W2 forms, which share the same information, but may vary in appearance by the company that created the document. Neural models currently only support English text.
46
+
* Neural models support documents that have the same information, but different page structures. Examples of these documents include United States W2 forms, which share the same information, but may vary in appearance across companies. Neural models currently only support English text.
45
47
46
48
This table provides links to the build mode programming language SDK references and code samples on GitHub:
47
49
@@ -68,15 +70,15 @@ The table below compares custom template and custom neural features:
68
70
69
71
The following tools are supported by Form Recognizer v2.1:
Copy file name to clipboardExpand all lines: articles/applied-ai-services/form-recognizer/quickstarts/try-v3-csharp-sdk.md
+4-4Lines changed: 4 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -152,7 +152,7 @@ Analyze and extract text, tables, structure, key-value pairs, and named entities
152
152
> * We've added the file URI value to the `Uri fileUri` variable at the top of the script.
153
153
> * For simplicity, all the entity fields that the service returns are not shown here. To see the list of all supported fields and corresponding types, see the [General document](../concept-general-document.md#named-entity-recognition-ner-categories) concept page.
154
154
155
-
### Add the following code to the Program.cs file:
155
+
**Add the following code sample to the Program.cs file:**
156
156
157
157
```csharp
158
158
usingAzure;
@@ -268,7 +268,7 @@ for (int i = 0; i < result.Tables.Count; i++)
268
268
### General document model output
269
269
270
270
Visit the Azure samples repository on GitHub to view the [general document model output](https://github.com/Azure-Samples/cognitive-services-quickstart-code/blob/master/dotnet/FormRecognizer/v3-csharp-sdk-general-document-output.md).
271
-
271
+
___
272
272
273
273
## Layout model
274
274
@@ -280,7 +280,7 @@ Extract text, selection marks, text styles, table structures, and bounding regio
280
280
> * We've added the file URI value to the `Uri fileUri` variable at the top of the script.
281
281
> * To extract the layout from a given file at a URI, use the `StartAnalyzeDocumentFromUri` method and pass `prebuilt-layout` as the model ID. The returned value is an `AnalyzeResult` object containing data from the submitted document.
282
282
283
-
#### Add the following code to the Program.cs file:
283
+
**Add the following code sample to the Program.cs file:**
284
284
285
285
```csharp
286
286
usingAzure;
@@ -383,7 +383,7 @@ Analyze and extract common fields from specific document types using a prebuilt
383
383
> * To analyze a given file at a URI, use the `StartAnalyzeDocumentFromUri` method and pass `prebuilt-invoice` as the model ID. The returned value is an `AnalyzeResult` object containing data from the submitted document.
384
384
> * For simplicity, all the key-value pairs that the service returns are not shown here. To see the list of all supported fields and corresponding types, see our [Invoice](../concept-invoice.md#field-extraction) concept page.
385
385
386
-
#### Add the following code to your Program.cs file:
386
+
**Add the following code sample to your Program.cs file:**
Get started with Azure Form Recognizer using the Python programming language. Azure Form Recognizer is a cloud-based Azure Applied AI Service that uses machine learning to extract key-value pairs, text, and tables from your documents. You can easily call Form Recognizer models by integrating our client library SDks into your workflows and applications. We recommend that you use the free service when you're learning the technology. Remember that the number of free pages is limited to 500 per month.
24
24
@@ -56,52 +56,17 @@ In this quickstart you'll use following features to analyze and extract data and
56
56
Open a terminal window in your local environment and install the Azure Form Recognizer client library for Python with pip:
57
57
58
58
```console
59
-
pip install azure-ai-formrecognizer==3.2.0b2
59
+
pip install azure-ai-formrecognizer==3.2.0b3
60
60
61
61
```
62
62
63
63
### Create a new Python application
64
64
65
-
Create a new Python file called **form_recognizer_quickstart.py** in your preferred editor or IDE. Then import the following libraries:
65
+
To interact with the Form Recognizer service, you'll need to create an instance of the `DocumentAnalysisClient` class. To do so, you'll create an `AzureKeyCredential` with your key from the Azure portal and a `DocumentAnalysisClient` instance with the `AzureKeyCredential` and your Form Recognizer `endpoint`.
66
66
67
-
```python
68
-
import os
69
-
from azure.core.exceptions import ResourceNotFoundError
70
-
from azure.ai.formrecognizer import DocumentAnalysisClient
71
-
from azure.core.credentials import AzureKeyCredential
72
-
```
73
-
74
-
### Create variables for your Azure resource API endpoint and key
75
-
76
-
```python
77
-
endpoint ="YOUR_FORM_RECOGNIZER_ENDPOINT"
78
-
key ="YOUR_FORM_RECOGNIZER_SUBSCRIPTION_KEY"
79
-
```
80
-
81
-
At this point, your Python application should contain the following lines of code:
82
-
83
-
```python
84
-
import os
85
-
from azure.core.exceptions import ResourceNotFoundError
86
-
from azure.ai.formrecognizer import DocumentAnalysisClient
87
-
from azure.core.credentials import AzureKeyCredential
88
-
89
-
endpoint ="YOUR_FORM_RECOGNIZER_ENDPOINT"
90
-
key ="YOUR_FORM_RECOGNIZER_SUBSCRIPTION_KEY"
91
-
92
-
```
93
-
94
-
> [!TIP]
95
-
> If you would like to try more than one code sample:
96
-
>
97
-
> * Select one of the sample code blocks below to copy and paste into your application.
98
-
> *[**Run your application**](#run-your-application).
99
-
> * Comment out that sample code block but keep the set-up code and library directives.
100
-
> * Select another sample code block to copy and paste into your application.
101
-
> *[**Run your application**](#run-your-application).
102
-
> * You can continue to comment out, copy/paste, and run the sample blocks of code.
103
-
104
-
### Select a code sample to copy and paste into your application:
67
+
1. Create a new Python file called **form_recognizer_quickstart.py** in your preferred editor or IDE.
68
+
69
+
1. Open the **form_recognizer_quickstart.py** file and select one of the following code samples to copy and pasted into your application:
105
70
106
71
*[**General document**](#general-document-model)
107
72
@@ -124,10 +89,20 @@ Extract text, tables, structure, key-value pairs, and named entities from docume
124
89
> * We've added the file URL value to the `docUrl` variable in the `analyze_general_documents` function.
125
90
> * For simplicity, all the entity fields that the service returns are not shown here. To see the list of all supported fields and corresponding types, see our [General document](../concept-general-document.md#named-entity-recognition-ner-categories) concept page.
126
91
127
-
###### Add the following code to your general document application on a line below the `key` variable
92
+
<!-- markdownlint-disable MD036 -->
93
+
**Add the following sample code to your form_recognizer_quickstart.py application:**
128
94
129
95
```python
130
96
97
+
# import libraries
98
+
import os
99
+
from azure.ai.formrecognizer import DocumentAnalysisClient
100
+
from azure.core.credentials import AzureKeyCredential
101
+
102
+
# set `<your-endpoint>` and `<your-key>` variables with the values from the Azure portal
Visit the Azure samples repository on GitHub to view the [general document model output](https://github.com/Azure-Samples/cognitive-services-quickstart-code/blob/master/python/FormRecognizer/v3-python-sdk-general-document-output.md)
230
+
231
+
___
232
+
252
233
## Layout model
253
234
254
235
Extract text, selection marks, text styles, table structures, and bounding region coordinates from documents.
@@ -259,10 +240,19 @@ Extract text, selection marks, text styles, table structures, and bounding regio
259
240
> * We've added the file URL value to the `formUrl` variable in the `analyze_layout` function.
260
241
> * To analyze a given file at a URL, you'll use the `begin_analyze_document_from_url` method and pass in `prebuilt-layout` as the model Id. The returned value is a `result` object containing data about the submitted document.
261
242
262
-
#### Add the following code to your layout application on the line below the `key` variable
243
+
**Add the following sample code to your form_recognizer_quickstart.py application:**
263
244
264
245
```python
265
246
247
+
# import libraries
248
+
import os
249
+
from azure.ai.formrecognizer import DocumentAnalysisClient
250
+
from azure.core.credentials import AzureKeyCredential
251
+
252
+
# set `<your-endpoint>` and `<your-key>` variables with the values from the Azure portal
Visit the Azure samples repository on GitHub to view the [layout model output](https://github.com/Azure-Samples/cognitive-services-quickstart-code/blob/master/python/FormRecognizer/v3-python-sdk-layout-output.md)
357
+
358
+
___
359
+
363
360
## Prebuilt model
364
361
365
-
In this example, we'll analyze an invoice using the **prebuilt-invoice** model.
362
+
Analyze and extract common fields from specific document types using a prebuilt model. In this example, we'll analyze an invoice using the **prebuilt-invoice** model.
366
363
367
364
> [!TIP]
368
365
> You aren't limited to invoices—there are several prebuilt models to choose from, each of which has its own set of supported fields. The model to use for the analyze operation depends on the type of document to be analyzed. See [**model data extraction**](../concept-model-overview.md#model-data-extraction).
369
366
370
-
#### Try the prebuilt invoice model
371
-
372
367
> [!div class="checklist"]
373
368
>
374
369
> * Analyze an invoice using the prebuilt-invoice model. You can use our [sample invoice document](https://raw.githubusercontent.com/Azure-Samples/cognitive-services-REST-api-samples/master/curl/form-recognizer/sample-invoice.pdf) for this quickstart.
375
370
> * We've added the file URL value to the `invoiceUrl` variable at the top of the file.
376
371
> * To analyze a given file at a URI, you'll use the `beginAnalyzeDocuments` method and pass `PrebuiltModels.Invoice` as the model Id. The returned value is a `result` object containing data about the submitted document.
377
372
> * For simplicity, all the key-value pairs that the service returns are not shown here. To see the list of all supported fields and corresponding types, see our [Invoice](../concept-invoice.md#field-extraction) concept page.
378
373
379
-
#### Add the following code to your prebuilt invoice application below the `key` variable
374
+
**Add the following sample code to your form_recognizer_quickstart.py application:**
380
375
381
376
```python
377
+
# import libraries
378
+
import os
379
+
from azure.ai.formrecognizer import DocumentAnalysisClient
380
+
from azure.core.credentials import AzureKeyCredential
381
+
382
+
# set `<your-endpoint>` and `<your-key>` variables with the values from the Azure portal
Visit the Azure samples repository on GitHub to view the [prebuilt invoice model output](https://github.com/Azure-Samples/cognitive-services-quickstart-code/blob/master/python/FormRecognizer/v3-python-sdk-prebuilt-invoice-output.md)
664
+
657
665
## Run your application
658
666
659
667
1. Navigate to the folder where you have your **form_recognizer_quickstart.py** file.
@@ -664,7 +672,7 @@ if __name__ == "__main__":
664
672
python form_recognizer_quickstart.py
665
673
```
666
674
667
-
That's it, congratulations!
675
+
That's it, congratulations!
668
676
669
677
In this quickstart, you used the Form Recognizer Python SDK to analyze various forms in different ways. Next, explore the reference documentation to learn more about Form Recognizer v3.0 API.
0 commit comments