Human Review Flow not triggert with low value confidence
0
Hi,
I`m using aws textract to extract information from an png. I want to trigger an human review workflow when textract has a low confidence of the value (not the key!). But it doesn't trigger. My supposition is that the aws console doesn't write the JSON correctly.
My png:
My python call:
response = textract.analyze_document(
Document={
"S3Object": {
"Bucket": "sagemakerawstextracttest",
"Name": "test.png"
}
},
HumanLoopConfig={
"FlowDefinitionArn":"arn:aws:sagemaker:eu-central-1:392047662260:flow-definition/confunderv2",
"HumanLoopName":"223456",
"DataAttributes" : {
"ContentClassifiers":["FreeOfPersonallyIdentifiableInformation","FreeOfAdultContent"]
}
},
FeatureTypes=["FORMS"])
The response:
{'DocumentMetadata': {'Pages': 1},
'Blocks': [{'BlockType': 'PAGE',
'Geometry': {'BoundingBox': {'Width': 1.0,
'Height': 1.0,
'Left': 0.0,
'Top': 0.0},
'Polygon': [{'X': 9.166517763292134e-17, 'Y': 0.0},
{'X': 1.0, 'Y': 1.6361280468230185e-16},
{'X': 1.0, 'Y': 1.0},
{'X': 0.0, 'Y': 1.0}]},
'Id': '731d5fe7-4ef1-483d-940d-75eb7a113034',
'Relationships': [{'Type': 'CHILD',
'Ids': ['d88b4e1d-257e-4ce2-9d45-8e72b1849c35',
'820a0720-e256-43c8-8608-c047c43e02fc',
'd39da0ab-5e3c-46df-a3d2-a96c8d7d62ca',
'83b498a5-e833-43bb-9562-c785d668c438',
'6849808f-f183-4535-92b1-20770cbdddd1',
'e6cb3e33-6c4a-4d8e-b51a-d8293b8ae487',
'9d731496-0f47-471a-828e-63ffc536b2f8',
'238a421e-8d4e-4927-a8e7-74c9b8e7c02b',
'afab5162-c4a8-462a-808e-9e73f2c199df']}]},
{'BlockType': 'LINE',
'Confidence': 99.37574005126953,
'Text': 'Name: Paul Spöring',
'Geometry': {'BoundingBox': {'Width': 0.5787070989608765,
'Height': 0.0934426411986351,
'Left': 0.09132613986730576,
'Top': 0.22022898495197296},
'Polygon': [{'X': 0.09132613986730576, 'Y': 0.22022898495197296},
{'X': 0.6700332760810852, 'Y': 0.22022898495197296},
{'X': 0.6700332760810852, 'Y': 0.31367161870002747},
{'X': 0.09132613986730576, 'Y': 0.31367161870002747}]},
'Id': 'd88b4e1d-257e-4ce2-9d45-8e72b1849c35',
'Relationships': [{'Type': 'CHILD',
'Ids': ['7a09146f-189a-4f63-9a1e-5b535161c73d',
'b3171404-53e3-4b73-9d32-848a26bb6b00',
'71b86f1d-c6d7-443c-bd34-a1bb7dbf059d']}]},
{'BlockType': 'LINE',
'Confidence': 99.62093353271484,
'Text': 'Alter: 20',
'Geometry': {'BoundingBox': {'Width': 0.2573024034500122,
'Height': 0.07728662341833115,
'Left': 0.08906695991754532,
'Top': 0.3895558714866638},
'Polygon': [{'X': 0.08906695991754532, 'Y': 0.3895558714866638},
{'X': 0.3463693857192993, 'Y': 0.3895558714866638},
{'X': 0.3463693857192993, 'Y': 0.46684250235557556},
{'X': 0.08906695991754532, 'Y': 0.46684250235557556}]},
'Id': '820a0720-e256-43c8-8608-c047c43e02fc',
'Relationships': [{'Type': 'CHILD',
'Ids': ['e869172f-4479-43e9-9310-bcccb5039bd1',
'22d76bef-3742-4aa1-9948-f10631f7be85']}]},
{'BlockType': 'LINE',
'Confidence': 82.59257507324219,
'Text': 'Blub: you',
'Geometry': {'BoundingBox': {'Width': 0.43706580996513367,
'Height': 0.11816448718309402,
'Left': 0.09128420799970627,
'Top': 0.560679018497467},
'Polygon': [{'X': 0.09128420799970627, 'Y': 0.560679018497467},
{'X': 0.5283499956130981, 'Y': 0.560679018497467},
{'X': 0.5283499956130981, 'Y': 0.6788434982299805},
{'X': 0.09128420799970627, 'Y': 0.6788434982299805}]},
'Id': 'd39da0ab-5e3c-46df-a3d2-a96c8d7d62ca',
'Relationships': [{'Type': 'CHILD',
'Ids': ['a9fd356f-1935-4f51-8053-02d1bf02f609',
'c657da1a-2441-4844-99bd-f301887eb5ed']}]},
{'BlockType': 'WORD',
'Confidence': 99.62495422363281,
'Text': 'Name:',
'TextType': 'PRINTED',
'Geometry': {'BoundingBox': {'Width': 0.19461767375469208,
'Height': 0.07422882318496704,
'Left': 0.09132613986730576,
'Top': 0.2239169031381607},
'Polygon': [{'X': 0.09132613986730576, 'Y': 0.2239169031381607},
{'X': 0.28594380617141724, 'Y': 0.2239169031381607},
{'X': 0.28594380617141724, 'Y': 0.29814571142196655},
{'X': 0.09132613986730576, 'Y': 0.29814571142196655}]},
'Id': '7a09146f-189a-4f63-9a1e-5b535161c73d'},
{'BlockType': 'WORD',
'Confidence': 98.95515441894531,
'Text': 'Paul',
'TextType': 'PRINTED',
'Geometry': {'BoundingBox': {'Width': 0.12700314819812775,
'Height': 0.07847694307565689,
'Left': 0.30101263523101807,
'Top': 0.22022898495197296},
'Polygon': [{'X': 0.30101263523101807, 'Y': 0.22022898495197296},
{'X': 0.428015798330307, 'Y': 0.22022898495197296},
{'X': 0.428015798330307, 'Y': 0.29870593547821045},
{'X': 0.30101263523101807, 'Y': 0.29870593547821045}]},
'Id': 'b3171404-53e3-4b73-9d32-848a26bb6b00'},
{'BlockType': 'WORD',
'Confidence': 99.54711151123047,
'Text': 'Spöring',
'TextType': 'PRINTED',
'Geometry': {'BoundingBox': {'Width': 0.23034201562404633,
'Height': 0.09066428989171982,
'Left': 0.4396912455558777,
'Top': 0.22300733625888824},
'Polygon': [{'X': 0.4396912455558777, 'Y': 0.22300733625888824},
{'X': 0.6700332760810852, 'Y': 0.22300733625888824},
{'X': 0.6700332760810852, 'Y': 0.31367161870002747},
{'X': 0.4396912455558777, 'Y': 0.31367161870002747}]},
'Id': '71b86f1d-c6d7-443c-bd34-a1bb7dbf059d'},
{'BlockType': 'WORD',
'Confidence': 99.47355651855469,
'Text': 'Alter:',
'TextType': 'PRINTED',
'Geometry': {'BoundingBox': {'Width': 0.16495245695114136,
'Height': 0.07728662341833115,
'Left': 0.08906695991754532,
'Top': 0.3895558714866638},
'Polygon': [{'X': 0.08906695991754532, 'Y': 0.3895558714866638},
{'X': 0.2540194094181061, 'Y': 0.3895558714866638},
{'X': 0.2540194094181061, 'Y': 0.46684250235557556},
{'X': 0.08906695991754532, 'Y': 0.46684250235557556}]},
'Id': 'e869172f-4479-43e9-9310-bcccb5039bd1'},
{'BlockType': 'WORD',
'Confidence': 99.76831817626953,
'Text': '20',
'TextType': 'PRINTED',
'Geometry': {'BoundingBox': {'Width': 0.07841669768095016,
'Height': 0.07549438625574112,
'Left': 0.26795268058776855,
'Top': 0.3907521665096283},
'Polygon': [{'X': 0.26795268058776855, 'Y': 0.3907521665096283},
{'X': 0.3463693857192993, 'Y': 0.3907521665096283},
{'X': 0.3463693857192993, 'Y': 0.4662465453147888},
{'X': 0.26795268058776855, 'Y': 0.4662465453147888}]},
'Id': '22d76bef-3742-4aa1-9948-f10631f7be85'},
{'BlockType': 'WORD',
'Confidence': 99.90613555908203,
'Text': 'Blub:',
'TextType': 'PRINTED',
'Geometry': {'BoundingBox': {'Width': 0.15235087275505066,
'Height': 0.07806506007909775,
'Left': 0.09128420799970627,
'Top': 0.560679018497467},
'Polygon': [{'X': 0.09128420799970627, 'Y': 0.560679018497467},
{'X': 0.24363507330417633, 'Y': 0.560679018497467},
{'X': 0.24363507330417633, 'Y': 0.638744056224823},
{'X': 0.09128420799970627, 'Y': 0.638744056224823}]},
'Id': 'a9fd356f-1935-4f51-8053-02d1bf02f609'},
{'BlockType': 'WORD',
'Confidence': 65.27902221679688,
'Text': 'you',
'TextType': 'HANDWRITING',
'Geometry': {'BoundingBox': {'Width': 0.2605644464492798,
'Height': 0.10577575862407684,
'Left': 0.26778554916381836,
'Top': 0.5730677247047424},
'Polygon': [{'X': 0.26778554916381836, 'Y': 0.5730677247047424},
{'X': 0.5283499956130981, 'Y': 0.5730677247047424},
{'X': 0.5283499956130981, 'Y': 0.6788434982299805},
{'X': 0.26778554916381836, 'Y': 0.6788434982299805}]},
'Id': 'c657da1a-2441-4844-99bd-f301887eb5ed'},
{'BlockType': 'KEY_VALUE_SET',
'Confidence': 95.0,
'Geometry': {'BoundingBox': {'Width': 0.14683577418327332,
'Height': 0.07679956406354904,
'Left': 0.09270352125167847,
'Top': 0.5600157380104065},
'Polygon': [{'X': 0.09270352125167847, 'Y': 0.5600157380104065},
{'X': 0.23953929543495178, 'Y': 0.5600157380104065},
{'X': 0.23953929543495178, 'Y': 0.6368153095245361},
{'X': 0.09270352125167847, 'Y': 0.6368153095245361}]},
'Id': '83b498a5-e833-43bb-9562-c785d668c438',
'Relationships': [{'Type': 'VALUE',
'Ids': ['6849808f-f183-4535-92b1-20770cbdddd1']},
{'Type': 'CHILD', 'Ids': ['a9fd356f-1935-4f51-8053-02d1bf02f609']}],
'EntityTypes': ['KEY']},
{'BlockType': 'KEY_VALUE_SET',
'Confidence': 95.0,
'Geometry': {'BoundingBox': {'Width': 0.25565099716186523,
'Height': 0.10435424745082855,
'Left': 0.27307748794555664,
'Top': 0.5714280009269714},
'Polygon': [{'X': 0.27307748794555664, 'Y': 0.5714280009269714},
{'X': 0.5287284851074219, 'Y': 0.5714280009269714},
{'X': 0.5287284851074219, 'Y': 0.6757822036743164},
{'X': 0.27307748794555664, 'Y': 0.6757822036743164}]},
'Id': '6849808f-f183-4535-92b1-20770cbdddd1',
'Relationships': [{'Type': 'CHILD',
'Ids': ['c657da1a-2441-4844-99bd-f301887eb5ed']}],
'EntityTypes': ['VALUE']},
{'BlockType': 'KEY_VALUE_SET',
'Confidence': 94.0,
'Geometry': {'BoundingBox': {'Width': 0.18979747593402863,
'Height': 0.06938383728265762,
'Left': 0.09253517538309097,
'Top': 0.22251036763191223},
'Polygon': [{'X': 0.09253517538309097, 'Y': 0.22251036763191223},
{'X': 0.2823326289653778, 'Y': 0.22251036763191223},
{'X': 0.2823326289653778, 'Y': 0.29189419746398926},
{'X': 0.09253517538309097, 'Y': 0.29189419746398926}]},
'Id': 'e6cb3e33-6c4a-4d8e-b51a-d8293b8ae487',
'Relationships': [{'Type': 'VALUE',
'Ids': ['9d731496-0f47-471a-828e-63ffc536b2f8']},
{'Type': 'CHILD', 'Ids': ['7a09146f-189a-4f63-9a1e-5b535161c73d']}],
'EntityTypes': ['KEY']},
{'BlockType': 'KEY_VALUE_SET',
'Confidence': 94.0,
'Geometry': {'BoundingBox': {'Width': 0.359325647354126,
'Height': 0.09458027780056,
'Left': 0.3059462904930115,
'Top': 0.21961979568004608},
'Polygon': [{'X': 0.3059462904930115, 'Y': 0.21961979568004608},
{'X': 0.6652719378471375, 'Y': 0.21961979568004608},
{'X': 0.6652719378471375, 'Y': 0.3142000734806061},
{'X': 0.3059462904930115, 'Y': 0.3142000734806061}]},
'Id': '9d731496-0f47-471a-828e-63ffc536b2f8',
'Relationships': [{'Type': 'CHILD',
'Ids': ['b3171404-53e3-4b73-9d32-848a26bb6b00',
'71b86f1d-c6d7-443c-bd34-a1bb7dbf059d']}],
'EntityTypes': ['VALUE']},
{'BlockType': 'KEY_VALUE_SET',
'Confidence': 90.0,
'Geometry': {'BoundingBox': {'Width': 0.16694426536560059,
'Height': 0.076688751578331,
'Left': 0.08947249501943588,
'Top': 0.38823941349983215},
'Polygon': [{'X': 0.08947249501943588, 'Y': 0.38823941349983215},
{'X': 0.25641676783561707, 'Y': 0.38823941349983215},
{'X': 0.25641676783561707, 'Y': 0.46492815017700195},
{'X': 0.08947249501943588, 'Y': 0.46492815017700195}]},
'Id': '238a421e-8d4e-4927-a8e7-74c9b8e7c02b',
'Relationships': [{'Type': 'VALUE',
'Ids': ['afab5162-c4a8-462a-808e-9e73f2c199df']},
{'Type': 'CHILD', 'Ids': ['e869172f-4479-43e9-9310-bcccb5039bd1']}],
'EntityTypes': ['KEY']},
{'BlockType': 'KEY_VALUE_SET',
'Confidence': 90.0,
'Geometry': {'BoundingBox': {'Width': 0.0738547071814537,
'Height': 0.0703207403421402,
'Left': 0.26923850178718567,
'Top': 0.39165323972702026},
'Polygon': [{'X': 0.26923850178718567, 'Y': 0.39165323972702026},
{'X': 0.34309321641921997, 'Y': 0.39165323972702026},
{'X': 0.34309321641921997, 'Y': 0.46197396516799927},
{'X': 0.26923850178718567, 'Y': 0.46197396516799927}]},
'Id': 'afab5162-c4a8-462a-808e-9e73f2c199df',
'Relationships': [{'Type': 'CHILD',
'Ids': ['22d76bef-3742-4aa1-9948-f10631f7be85']}],
'EntityTypes': ['VALUE']}],
'HumanLoopActivationOutput': {'HumanLoopActivationReasons': [],
'HumanLoopActivationConditionsEvaluationResults': '{"Conditions":[{"And":[{"ConditionType":"ImportantFormKeyConfidenceCheck","ConditionParameters":{"ImportantFormKey":"*","ImportantFormKeyAliases":[],"KeyValueBlockConfidenceLessThan":20.0,"WordBlockConfidenceLessThan":90.0},"EvaluationResult":false},{"ConditionType":"ImportantFormKeyConfidenceCheck","ConditionParameters":{"ImportantFormKey":"*","ImportantFormKeyAliases":[],"KeyValueBlockConfidenceGreaterThan":0.0,"WordBlockConfidenceGreaterThan":0.0},"EvaluationResult":true}],"EvaluationResult":false}]}'},
'AnalyzeDocumentModelVersion': '1.0',
'ResponseMetadata': {'RequestId': '33e55167-74c8-461b-b83e-ccda0603c1a7',
'HTTPStatusCode': 200,
'HTTPHeaders': {'x-amzn-requestid': '33e55167-74c8-461b-b83e-ccda0603c1a7',
'content-type': 'application/x-amz-json-1.1',
'content-length': '10018',
'date': 'Tue, 04 Oct 2022 12:41:57 GMT'},
'RetryAttempts': 0}}
As you can see is the confidence in the key quite high, but the confidence in the value of the key "Blub" low.
My console configuration:
And the JSON that the console makes from it:
{
"Conditions": [
{
"And": [
{
"ConditionType": "ImportantFormKeyConfidenceCheck",
"ConditionParameters": {
"ImportantFormKey": "*",
"KeyValueBlockConfidenceLessThan": 20,
"WordBlockConfidenceLessThan": 90
}
},
{
"ConditionType": "ImportantFormKeyConfidenceCheck",
"ConditionParameters": {
"ImportantFormKey": "*",
"KeyValueBlockConfidenceGreaterThan": 0,
"WordBlockConfidenceGreaterThan": 0
}
}
]
}
]
}
My question is, how to I configure it, that the human review flow is triggert, when the confidence of the value (not the key, or key and value) is low?
Best regards,
Paul
gefragt vor 2 Jahren90 Aufrufelg...
Keine Antworten
- Neueste
- Die meisten Stimmen
- Die meisten Kommentare
Relevanter Inhalt
- AWS OFFICIALAktualisiert vor einem Jahr
- AWS OFFICIALAktualisiert vor einem Jahr
- AWS OFFICIALAktualisiert vor 6 Monaten