Mantieni tutto organizzato con le raccolte
Salva e classifica i contenuti in base alle tue preferenze.
Puoi addestrare un modello ad alto rendimento con un minimo di tre documenti di addestramento e tre di test per i casi d'uso con layout fisso. Accelera lo sviluppo e riduci i tempi di produzione per i tipi di documenti basati su modelli come W9, 1040, ACORD, sondaggi e questionari.
Configurazione del set di dati
Per addestrare, eseguire l'ottimizzazione dell'addestramento o valutare una versione del processore è necessario un set di dati di documenti.
I processori Document AI imparano dagli esempi, proprio come gli esseri umani. Il set di dati alimenta
la stabilità del processore in termini di prestazioni.
Addestrare set di dati
Per migliorare il modello e la sua accuratezza, addestra un set di dati sui tuoi documenti. Il modello è
composto da documenti con dati di fatto. Per addestrare un nuovo modello sono necessari almeno tre documenti.
Set di dati di test
Il set di dati di test è ciò che il modello utilizza per generare un punteggio F1 (accuratezza). È
composto da documenti con dati di riferimento. Per vedere la frequenza con cui il modello è corretto, i dati empirici reali vengono utilizzati per confrontare le previsioni del modello (campi estratti dal modello) con le risposte corrette. Il set di dati di test deve contenere almeno tre documenti.
Best practice per l'etichettatura in modalità modello
L'etichettatura corretta è uno dei passaggi più importanti per ottenere un'elevata precisione.
La modalità Modello ha una metodologia di etichettatura unica che differisce dalle altre modalità di addestramento:
Disegna i riquadri di selezione intorno all'intera area in cui prevedi che si trovino i dati (per etichetta)
all'interno di un documento, anche se l'etichetta è vuota nel documento di addestramento che stai etichettando.
Puoi etichettare i campi vuoti per l'addestramento basato su template. Non etichettare i campi vuoti
per l'addestramento basato su modello.
Creare e valutare un estrattore personalizzato con la modalità modello
Imposta la località del set di dati. Seleziona la cartella delle opzioni predefinite (gestite da Google). Questa
operazione potrebbe essere eseguita automaticamente poco dopo la creazione del processore.
Vai alla scheda Crea e seleziona Importa documenti con l'etichettatura automatica
attivata. L'aggiunta di più documenti rispetto al minimo di tre necessari in genere non migliora la qualità dell'addestramento basato su modelli. Anziché aggiungerne altre, concentrati sull'etichettatura di un piccolo insieme in modo molto preciso.
Estendi i riquadri di delimitazione. Queste caselle per la modalità modello dovrebbero avere l'aspetto degli esempi precedenti. Estendi i riquadri di selezione seguendo le best practice per ottenere il risultato ottimale.
Addestra il modello.
Seleziona Addestra nuova versione.
Assegna un nome alla versione del processore.
Vai a Mostra opzioni avanzate e seleziona l'approccio basato su modelli.
Valutazione.
Vai a Valutazione e test.
Seleziona la versione appena addestrata, quindi Visualizza valutazione completa.
Ora visualizzi metriche come F1, precisione e richiamo per l'intero documento e per ogni campo.
1. Decidi se il rendimento soddisfa i tuoi obiettivi di produzione e, in caso contrario, rivaluta i set di addestramento e test.
Imposta una nuova versione come predefinita.
Vai a Gestisci versioni.
Seleziona per visualizzare il menu delle impostazioni, quindi seleziona Imposta come predefinito.
Il modello è ora implementato e i documenti inviati a questo processore utilizzano la tua versione personalizzata. Vuoi valutare il rendimento del modello (maggiori dettagli su come farlo) per verificare se richiede ulteriore addestramento.
Riferimento alla valutazione
Il motore di valutazione può eseguire la corrispondenza esatta o la corrispondenza fuzzy.
Per una corrispondenza esatta, il valore estratto deve corrispondere esattamente al dato di riferimento o viene conteggiato come mancata corrispondenza.
Le estrazioni con corrispondenza fuzzy che presentavano lievi differenze, ad esempio differenze di maiuscole e minuscole, vengono comunque conteggiate come corrispondenze. Puoi modificarlo nella schermata Valutazione.
Etichettatura automatica con il modello di base
Il foundation model è in grado di estrarre con precisione i campi per vari tipi di documenti, ma puoi anche fornire dati di addestramento aggiuntivi per migliorare l'accuratezza del modello per strutture di documenti specifiche.
Document AI utilizza i nomi delle etichette che definisci e le annotazioni precedenti per rendere più rapida e semplice l'etichettatura dei documenti su larga scala grazie all'etichettatura automatica.
Dopo aver creato un processore personalizzato, vai alla scheda Inizia.
Seleziona Crea nuovo campo.
Vai alla scheda Crea e seleziona Importa documenti.
Seleziona il percorso dei documenti e il set in cui devono essere importati. Seleziona la casella di controllo dell'etichettatura automatica e seleziona il modello di base.
Nella scheda Crea, seleziona Gestisci set di dati. Dovresti vedere i documenti
importati. Seleziona uno dei tuoi documenti.
Le previsioni del modello sono evidenziate in viola. Devi esaminare
ogni etichetta prevista dal modello e assicurarti che sia corretta. Se mancano
campi, devi aggiungerli.
Una volta esaminato il documento, seleziona Contrassegna come etichettato.
Il documento è ora pronto per essere utilizzato dal modello. Assicurati che il documento si trovi nel set di test o di addestramento.
[[["Facile da capire","easyToUnderstand","thumb-up"],["Il problema è stato risolto","solvedMyProblem","thumb-up"],["Altra","otherUp","thumb-up"]],[["Difficile da capire","hardToUnderstand","thumb-down"],["Informazioni o codice di esempio errati","incorrectInformationOrSampleCode","thumb-down"],["Mancano le informazioni o gli esempi di cui ho bisogno","missingTheInformationSamplesINeed","thumb-down"],["Problema di traduzione","translationIssue","thumb-down"],["Altra","otherDown","thumb-down"]],["Ultimo aggiornamento 2025-09-04 UTC."],[[["\u003cp\u003eTemplate-based extraction allows for training a high-performing model with a minimum of three training and three test documents, ideal for fixed-layout documents like W9s and questionnaires.\u003c/p\u003e\n"],["\u003cp\u003eA document dataset, comprising documents with ground-truth data, is essential for training, up-training, and evaluating a processor version, as the processor learns from these examples.\u003c/p\u003e\n"],["\u003cp\u003eFor template mode labeling, it is recommended to draw bounding boxes around the entire expected data area within a document, even if the field is empty in the training document, unlike model-based training.\u003c/p\u003e\n"],["\u003cp\u003eWhen building a custom extractor, auto-labeling can be enabled during document import, and it is advised to focus on accurately labeling a small set of documents rather than adding more documents during template-based training.\u003c/p\u003e\n"],["\u003cp\u003eThe foundation model allows for auto-labeling, which can be improved in accuracy and performance with the addition of training data with descriptive label names, while ensuring that all fields are accurate.\u003c/p\u003e\n"]]],[],null,["# Template-based extraction\n=========================\n\nYou can train a high-performing model with as little as three training and three test\ndocuments for fixed-layout use cases. Accelerate development and reduce time to\nproduction for templated document types like W9, 1040, ACORD, surveys, and questionnaires.\n\n\nDataset configuration\n---------------------\n\nA document dataset is required to train, up-train, or evaluate a processor version. Document AI processors learn from examples, just like humans. Dataset fuels processor stability in terms of performance. \n\n### Train dataset\n\nTo improve the model and its accuracy, train a dataset on your documents. The model is made up of documents with ground-truth. You need a minimum of three documents to train a new model. Ground-truth is the correctly labeled data, as determined by humans.\n\n### Test dataset\n\nThe test dataset is what the model uses to generate an F1 score (accuracy). It is made up of documents with ground-truth. To see how often the model is right, the ground truth is used to compare the model's predictions (extracted fields from the model) with the correct answers. The test dataset should have at least three documents.\n\n\u003cbr /\u003e\n\nBefore you begin\n----------------\n\nIf not already done, enable:\n\n- [Billing](/document-ai/docs/setup#billing)\n- [Document AI API](/document-ai/docs/setup)\n\nTemplate-mode labeling best practices\n-------------------------------------\n\nProper labeling is one of the most important steps to achieving high accuracy.\nTemplate mode has some unique labeling methodology that differs from other training modes:\n\n- Draw bounding boxes around the entire area you expect data to be in (per label) within a document, even if the label is empty in the training document you're labeling.\n- You may label empty fields for template-based training. Don't label empty fields for model-based training.\n\n| **Recommended.** Labeling example for template-based training to extract the top section of a 1040.\n| **Not recommended.** Labeling example for template-based training to extract the top section of a 1040. This is the labeling technique you should use for model-based training for documents with layout variation across documents.\n\nBuild and evaluate a custom extractor with template mode\n--------------------------------------------------------\n\n1. Create a custom extractor. [Create a processor](/document-ai/docs/workbench/build-custom-processor#create_a_processor)\n and [define fields](/document-ai/docs/workbench/build-custom-processor#define_processor_fields)\n you want to extract following [best practices](/document-ai/docs/workbench/label-documents#name-fields),\n which is important because it impacts extraction quality.\n\n2. Set dataset location. Select the default option folder (Google-managed). This\n might be done automatically shortly after creating the processor.\n\n3. Navigate to the **Build** tab and select **Import documents** with auto-labeling\n enabled. Adding more documents than the minimum of three needed typically doesn't improve quality for\n template-based training. Instead of adding more, focus on labeling a small set very accurately.\n\n | **Note:** You can experiment by increasing the training set size if you observe template variations in your dataset. Try to include at least three training documents per variation. At least three training documents, three test documents, and three schema labels are required per set.\n4. Extend bounding boxes. These boxes for template mode should look like the preceding\n examples. Extend the bounding boxes, following the best practices for the optimal result.\n\n5. Train model.\n\n 1. Select **Train new version**.\n 2. Name the processor version.\n 3. Go to **Show advanced options** and select the template-based model approach.\n\n | **Note:** It takes some time for the training to complete.\n6. Evaluation.\n\n 1. Go to **Evaluate \\& test**.\n 2. Select the version you just trained, then select **View Full Evaluation**.\n\n You now see metrics such as F1, precision, and recall for the entire document and each field.\n 1. Decide if performance meets your production goals, and if not, reevaluate training and testing sets.\n7. Set a new version as the default.\n\n 1. Navigate to **Manage versions**.\n 2. Select to see the settings menu, then mark **Set as default**.\n\n Your model is now deployed and documents sent to this processor use your custom\n version. You want to evaluate the model's performance ([more details](/document-ai/docs/workbench/evaluate)\n on how to do that) to check if it requires further training.\n\nEvaluation reference\n--------------------\n\nThe evaluation engine can do both exact match or [fuzzy matching](/document-ai/docs/workbench/evaluate#fuzzy_matching).\nFor an exact match, the extracted value must exactly match the ground truth or is counted as a miss.\n\nFuzzy matching extractions that had slight differences such as capitalization\ndifferences still count as a match. This can be changed at the **Evaluation** screen.\n\nAuto-labeling with the foundation model\n---------------------------------------\n\nThe foundation model can accurately extract fields for a variety of document types,\nbut you can also provide additional training data to improve the accuracy of the\nmodel for specific document structures.\n\nDocument AI uses the label names you define and previous annotations to make\nit quicker and easier to label documents at scale with auto-labeling.\n\n1. After creating a custom processor, go to the **Get started** tab.\n2. Select **Create New Field**.\n\n | **Note:** The label name with the foundation model can greatly affect model accuracy and performance. Be sure to give a descriptive name.\n\n3. Navigate to the **Build** tab and then select **Import documents**.\n\n4. Select the path of the documents and which set the documents should be imported\n into. Check the auto-labeling checkbox and select the foundation model.\n\n5. In the **Build** tab, select **Manage dataset**. You should see your imported\n documents. Select one of your documents.\n\n6. You see the predictions from the model highlighted in purple, you need to review\n each label predicted by the model and ensure it's correct. If there are missing\n fields, you need to add those as well.\n\n | **Note:** It's important that all fields are as accurate as possible or model performance is going to be affected. For more [details on labeling](/document-ai/docs/workbench/label-documents).\n\n7. Once the document has been reviewed, select **Mark as labeled**.\n\n8. The document is now ready to be used by the model. Make sure the document is\n in either the testing or training set."]]