How to add Confidence metric to items in a Custom Extraction Model

Tony Asmar 0 Reputation points
2025-01-30T09:06:52.12+00:00

Hi Dears;

I am using a Custom Extraction Model which I've trained on numerous receipts, but my problem is that it gives me a confidence score for the overall receipt info like transactionDate, transactionTime, merchantName etc... but not for the table of items there is no confidence level returned (Sample response from the OCR below confidence=None) :

AnalyzedDocument(doc_type=Jawaez_Leb_V7, bounding_regions=[BoundingRegion(page_number=1, polygon=[Point(x=0.0, y=0.0), Point(x=810.0, y=0.0), Point(x=810.0, y=1080.0), Point(x=0.0, y=1080.0)])], spans=[DocumentSpan(offset=0, length=588)], fields={'MerchantAddress': DocumentField(value_type=string, value='Jisr Al Bacha', content=Jisr Al Bacha, bounding_regions=[BoundingRegion(page_number=1, polygon=[Point(x=346.0, y=285.0), Point(x=485.0, y=288.0), Point(x=484.0, y=313.0), Point(x=345.0, y=310.0)])], spans=[DocumentSpan(offset=33, length=13)], confidence=0.823), 'MerchantName': DocumentField(value_type=string, value='Boulangerie El Bacha Keirouz SAL', content=Boulangerie El Bacha Keirouz SAL, bounding_regions=[BoundingRegion(page_number=1, polygon=[Point(x=190.0, y=225.0), Point(x=594.0, y=247.0), Point(x=591.0, y=298.0), Point(x=187.0, y=276.0)])], spans=[DocumentSpan(offset=0, length=32)], confidence=0.732), 'Total': DocumentField(value_type=float, value=None, content=375,000, bounding_regions=[BoundingRegion(page_number=1, polygon=[Point(x=496.0, y=917.0), Point(x=627.0, y=906.0), Point(x=629.0, y=929.0), Point(x=498.0, y=940.0)])], spans=[DocumentSpan(offset=517, length=7)], confidence=0.876), 'TransactionDate': DocumentField(value_type=date, value=None, content=29/01/2025, bounding_regions=[BoundingRegion(page_number=1, polygon=[Point(x=315.0, y=416.0), Point(x=424.0, y=416.0), Point(x=424.0, y=440.0), Point(x=315.0, y=440.0)])], spans=[DocumentSpan(offset=158, length=10)], confidence=0.889), 'TransactionTime': DocumentField(value_type=time, value=None, content=03:52:55 PM, bounding_regions=[BoundingRegion(page_number=1, polygon=[Point(x=432.0, y=416.0), Point(x=547.0, y=417.0), Point(x=547.0, y=441.0), Point(x=432.0, y=440.0)])], spans=[DocumentSpan(offset=169, length=11)], confidence=0.89), 'MerchantPhoneNumber': DocumentField(value_type=integer, value=1766120054, content=01.499992 - 03.965558, bounding_regions=[BoundingRegion(page_number=1, polygon=[Point(x=327.0, y=309.0), Point(x=547.0, y=317.0), Point(x=546.0, y=343.0), Point(x=326.0, y=334.0)])], spans=[DocumentSpan(offset=52, length=21)], confidence=0.862), 'Currency': DocumentField(value_type=string, value='LBP', content=LBP, bounding_regions=[BoundingRegion(page_number=1, polygon=[Point(x=414.0, y=924.0), Point(x=465.0, y=920.0), Point(x=467.0, y=942.0), Point(x=415.0, y=946.0)])], spans=[DocumentSpan(offset=513, length=3)], confidence=0.856), 'Items': DocumentField(value_type=list, value=[DocumentField(value_type=dictionary, value={'Description': DocumentField(value_type=string, value='Water Small', content=Water Small, bounding_regions=[BoundingRegion(page_number=1, polygon=[Point(x=304.0, y=545.0), Point(x=423.0, y=544.0), Point(x=423.0, y=566.0), Point(x=304.0, y=568.0)])], spans=[DocumentSpan(offset=230, length=11)], confidence=None), 'Quantity': DocumentField(value_type=float, value=None, content=1, bounding_regions=[BoundingRegion(page_number=1, polygon=[Point(x=187.0, y=548.0), Point(x=195.0, y=548.0), Point(x=195.0, y=568.0), Point(x=187.0, y=568.0)])], spans=[DocumentSpan(offset=226, length=1)], confidence=None), 'TotalPrice': DocumentField(value_type=float, value=None, content=20,000, bounding_regions=[BoundingRegion(page_number=1, polygon=[Point(x=567.0, y=542.0), Point(x=624.0, y=541.0), Point(x=624.0, y=562.0), Point(x=567.0, y=563.0)])], spans=[DocumentSpan(offset=242, length=6)], confidence=None)}, content=None, bounding_regions=[], spans=[], confidence=None), DocumentField(value_type=dictionary, value={'Description': DocumentField(value_type=string, value='Pain Arabe', content=Pain Arabe, bounding_regions=[BoundingRegion(page_number=1, polygon=[Point(x=306.0, y=571.0), Point(x=414.0, y=570.0), Point(x=414.0, y=592.0), Point(x=306.0, y=594.0)])], spans=[DocumentSpan(offset=251, length=10)], confidence=None), 'Quantity': DocumentField(value_type=float, value=None, content=1, bounding_regions=[BoundingRegion(page_number=1, polygon=[Point(x=188.0, y=575.0), Point(x=196.0, y=575.0), Point(x=196.0, y=594.0), Point(x=188.0, y=594.0)])], spans=[DocumentSpan(offset=249, length=1)], confidence=None), 'TotalPrice': DocumentField(value_type=float, value=None, content=65,000, bounding_regions=[BoundingRegion(page_number=1, polygon=[Point(x=567.0, y=565.0), Point(x=624.0, y=565.0), Point(x=624.0, y=587.0), Point(x=567.0, y=587.0)])], spans=[DocumentSpan(offset=262, length=6)], confidence=None)}, content=None, bounding_regions=[], spans=[], confidence=None), DocumentField(value_type=dictionary, value={'Description': DocumentField(value_type=string, value='Ajine Mne2ish Abyad', content=Ajine Mne2ish Abyad, bounding_regions=[BoundingRegion(page_number=1, polygon=[Point(x=306.0, y=597.0), Point(x=510.0, y=593.0), Point(x=510.0, y=618.0), Point(x=306.0, y=622.0)])], spans=[DocumentSpan(offset=273, length=19)], confidence=None), 'Quantity': DocumentField(value_type=float, value=None, content=1, bounding_regions=[BoundingRegion(page_number=1, polygon=[Point(x=188.0, y=601.0), Point(x=196.0, y=601.0), Point(x=197.0, y=620.0), Point(x=189.0, y=621.0)])], spans=[DocumentSpan(offset=269, length=1)], confidence=None), 'TotalPrice': DocumentField(value_type=float, value=None, content=95,000, bounding_regions=[BoundingRegion(page_number=1, polygon=[Point(x=568.0, y=591.0), Point(x=623.0, y=590.0), Point(x=623.0, y=613.0), Point(x=568.0, y=614.0)])], spans=[DocumentSpan(offset=293, length=6)], confidence=None)}, content=None, bounding_regions=[], spans=[], confidence=None), DocumentField(value_type=dictionary, value={'Description': DocumentField(value_type=string, value='Toast Asmar tary', content=Toast Asmar tary, bounding_regions=[BoundingRegion(page_number=1, polygon=[Point(x=308.0, y=623.0), Point(x=477.0, y=621.0), Point(x=477.0, y=644.0), Point(x=308.0, y=646.0)])], spans=[DocumentSpan(offset=302, length=16)], confidence=None), 'Quantity': DocumentField(value_type=float, value=None, content=1, bounding_regions=[BoundingRegion(page_number=1, polygon=[Point(x=189.0, y=627.0), Point(x=197.0, y=627.0), Point(x=196.0, y=647.0), Point(x=188.0, y=646.0)])], spans=[DocumentSpan(offset=300, length=1)], confidence=None), 'TotalPrice': DocumentField(value_type=float, value=None, content=195,000, bounding_regions=[BoundingRegion(page_number=1, polygon=[Point(x=559.0, y=617.0), Point(x=625.0, y=615.0), Point(x=626.0, y=637.0), Point(x=559.0, y=639.0)])], spans=[DocumentSpan(offset=319, length=7)], confidence=None)}, content=None, bounding_regions=[], spans=[], confidence=None)], content=None, bounding_regions=[], spans=[], confidence=None), 'Subtotal': DocumentField(value_type=float, value=None, content=None, bounding_regions=[], spans=[], confidence=0.966)}, confidence=0.987)

Azure AI Document Intelligence
Azure AI Document Intelligence
An Azure service that turns documents into usable data. Previously known as Azure Form Recognizer.
1,899 questions
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.