Model training failure could not build the model: Cannot use fields.json; All labels are processed as normal key-value fields.

K. B 6 Reputation points
2022-11-29T15:31:08.47+00:00

Hello, while trying to evaluate if Formrecognizer can meet the requirements of our Company I ran into an issue today:

265296-grafik.png

unfortunately i could not find any references to this issue online.

The Error occurs no matter if i train the model through the Formrecognizer Studio UI or through the dotnet SDK.

The Steps i took to get here were:
I followed the documentation and uploaded my trainingdata to an azure blob storage container.

then i labled my data:
265277-grafik.png
265265-grafik.png

after clicking train in the top right i get this issue i posted at the top

I assume the error is in relation to the fields.json file in my training-data "folder" (azure blob storage doesnt really have folders per se afaik)
265307-grafik.png

My issue now is that the File was automatically generated by the labeling process and i had no stake in creating / editing it so now i unfortunatly have no idea how to proceed from here.
reuploading the files and labeling again would be my last resort as that process was incredibly time consuming.

I would greatly appreciate any insight you might have that might point me in the correct direction from where its no longer an issue or i am able to fix it myself.

edit*: content of my fields.json if that helps

   {  
   	"$schema": "https://schema.cognitiveservices.azure.com/formrecognizer/2021-03-01/fields.json",  
   	"fields": [  
   		{  
   			"fieldKey": "1_anrede",  
   			"fieldType": "string",  
   			"fieldFormat": "not-specified"  
   		},  
   		{  
   			"fieldKey": "1_vorname",  
   			"fieldType": "string",  
   			"fieldFormat": "not-specified"  
   		},  
   		{  
   			"fieldKey": "1_familienname",  
   			"fieldType": "string",  
   			"fieldFormat": "not-specified"  
   		},  
   		{  
   			"fieldKey": "1_geburtsdatum",  
   			"fieldType": "string",  
   			"fieldFormat": "not-specified"  
   		},  
   		{  
   			"fieldKey": "1_strasse",  
   			"fieldType": "string",  
   			"fieldFormat": "not-specified"  
   		},  
   		{  
   			"fieldKey": "1_hausnummer",  
   			"fieldType": "string",  
   			"fieldFormat": "not-specified"  
   		},  
   		{  
   			"fieldKey": "1_postleitzahl",  
   			"fieldType": "string",  
   			"fieldFormat": "not-specified"  
   		},  
   		{  
   			"fieldKey": "1_wohnort",  
   			"fieldType": "string",  
   			"fieldFormat": "not-specified"  
   		},  
   		{  
   			"fieldKey": "1_nummer_der_bedarfsgemeinschaft",  
   			"fieldType": "string",  
   			"fieldFormat": "not-specified"  
   		},  
   		{  
   			"fieldKey": "2_anzahl_der_personen_in_meiner_unterkunft",  
   			"fieldType": "string",  
   			"fieldFormat": "not-specified"  
   		},  
   		{  
   			"fieldKey": "2_familienstand_eines_mitglieds_aendert_sich",  
   			"fieldType": "selectionMark",  
   			"fieldFormat": "not-specified"  
   		},  
   		{  
   			"fieldKey": "2_name_der_person",  
   			"fieldType": "string",  
   			"fieldFormat": "not-specified"  
   		},  
   		{  
   			"fieldKey": "2_art_der_aenderung",  
   			"fieldType": "string",  
   			"fieldFormat": "not-specified"  
   		},  
   		{  
   			"fieldKey": "2_tag_der_aenderung",  
   			"fieldType": "string",  
   			"fieldFormat": "not-specified"  
   		},  
   		{  
   			"fieldKey": "2_umzug_gesamte_gemeinschaft",  
   			"fieldType": "selectionMark",  
   			"fieldFormat": "not-specified"  
   		},  
   		{  
   			"fieldKey": "2_ein_oder_auszug",  
   			"fieldType": "selectionMark",  
   			"fieldFormat": "not-specified"  
   		},  
   		{  
   			"fieldKey": "3_arbeitseinkommen_aus_erwerbstaetigkeit",  
   			"fieldType": "selectionMark",  
   			"fieldFormat": "not-specified"  
   		},  
   		{  
   			"fieldKey": "3_arbeitseinkommen_name_der_person_1",  
   			"fieldType": "string",  
   			"fieldFormat": "not-specified"  
   		},  
   		{  
   			"fieldKey": "3_die_taetigkeit_wird_wurde_als_ferienjob_ausgeuebt_1",  
   			"fieldType": "string",  
   			"fieldFormat": "not-specified"  
   		},  
   		{  
   			"fieldKey": "3_die_taetigkeit_wird_wurde_als_ferienjob_ausgeuebt_2",  
   			"fieldType": "selectionMark",  
   			"fieldFormat": "not-specified"  
   		},  
   		{  
   			"fieldKey": "3_ausuebung_einer_selbststaendigen_taetigkeit",  
   			"fieldType": "selectionMark",  
   			"fieldFormat": "not-specified"  
   		},  
   		{  
   			"fieldKey": "3_arbeitslosengeld",  
   			"fieldType": "selectionMark",  
   			"fieldFormat": "not-specified"  
   		},  
   		{  
   			"fieldKey": "3_renten",  
   			"fieldType": "selectionMark",  
   			"fieldFormat": "not-specified"  
   		},  
   		{  
   			"fieldKey": "3_unterhaltszahlungen",  
   			"fieldType": "selectionMark",  
   			"fieldFormat": "not-specified"  
   		},  
   		{  
   			"fieldKey": "3_einnahmen_aus_vermietung_untervermietung_oder_verpachtung",  
   			"fieldType": "selectionMark",  
   			"fieldFormat": "not-specified"  
   		},  
   		{  
   			"fieldKey": "3_sonstige_entgeltersatzleistungen",  
   			"fieldType": "selectionMark",  
   			"fieldFormat": "not-specified"  
   		},  
   		{  
   			"fieldKey": "3_sachbezuege",  
   			"fieldType": "selectionMark",  
   			"fieldFormat": "not-specified"  
   		},  
   		{  
   			"fieldKey": "3_wohngeld_sozialhilfe_weitere_sozialleistungen",  
   			"fieldType": "selectionMark",  
   			"fieldFormat": "not-specified"  
   		},  
   		{  
   			"fieldKey": "3_bafoeg_berufsausbildungsbeihilfe_ausbildungsgeld",  
   			"fieldType": "selectionMark",  
   			"fieldFormat": "not-specified"  
   		},  
   		{  
   			"fieldKey": "3_sonstige_laufende_einnahmen",  
   			"fieldType": "selectionMark",  
   			"fieldFormat": "not-specified"  
   		},  
   		{  
   			"fieldKey": "4_absetzungen_vom_einkommen_haben_sich_geandert_ja",  
   			"fieldType": "selectionMark",  
   			"fieldFormat": "not-specified"  
   		},  
   		{  
   			"fieldKey": "5_mir_entstehen_kosten_fuer_unterkunft_und_heizung_ja",  
   			"fieldType": "selectionMark",  
   			"fieldFormat": "not-specified"  
   		},  
   		{  
   			"fieldKey": "5_mir_entstehen_kosten_fuer_unterkunft_und_heizung_nein",  
   			"fieldType": "selectionMark",  
   			"fieldFormat": "not-specified"  
   		},  
   		{  
   			"fieldKey": "5_miete_grundmiete",  
   			"fieldType": "string",  
   			"fieldFormat": "not-specified"  
   		},  
   		{  
   			"fieldKey": "5_ich_wohne_zur_miete",  
   			"fieldType": "selectionMark",  
   			"fieldFormat": "not-specified"  
   		},  
   		{  
   			"fieldKey": "5_miete_nebenkosten",  
   			"fieldType": "string",  
   			"fieldFormat": "not-specified"  
   		},  
   		{  
   			"fieldKey": "5_miete_heizkosten",  
   			"fieldType": "string",  
   			"fieldFormat": "not-specified"  
   		},  
   		{  
   			"fieldKey": "5_miete_sonstige_wohnkosten",  
   			"fieldType": "string",  
   			"fieldFormat": "not-specified"  
   		},  
   		{  
   			"fieldKey": "7_betreuung_durch_amtsgericht_bestellt",  
   			"fieldType": "selectionMark",  
   			"fieldFormat": "not-specified"  
   		},  
   		{  
   			"fieldKey": "7_ort",  
   			"fieldType": "string",  
   			"fieldFormat": "not-specified"  
   		},  
   		{  
   			"fieldKey": "7_datum",  
   			"fieldType": "string",  
   			"fieldFormat": "not-specified"  
   		},  
   		{  
   			"fieldKey": "7_bestaetigung_ort",  
   			"fieldType": "string",  
   			"fieldFormat": "not-specified"  
   		},  
   		{  
   			"fieldKey": "7_bestaetigung_datum",  
   			"fieldType": "string",  
   			"fieldFormat": "not-specified"  
   		},  
   		{  
   			"fieldKey": "2_umzug_am",  
   			"fieldType": "string",  
   			"fieldFormat": "not-specified"  
   		},  
   		{  
   			"fieldKey": "2_einauszug_vorname",  
   			"fieldType": "string",  
   			"fieldFormat": "not-specified"  
   		},  
   		{  
   			"fieldKey": "2_einauszug_familienname",  
   			"fieldType": "string",  
   			"fieldFormat": "not-specified"  
   		},  
   		{  
   			"fieldKey": "2_einzug_am",  
   			"fieldType": "string",  
   			"fieldFormat": "not-specified"  
   		},  
   		{  
   			"fieldKey": "3_name_und_firmenanschrift_des_arbeitgebers_1",  
   			"fieldType": "string",  
   			"fieldFormat": "not-specified"  
   		},  
   		{  
   			"fieldKey": "3_die_taetigkeit_wird_wurde_als_ferienjob_ausgeuebt_1",  
   			"fieldType": "selectionMark",  
   			"fieldFormat": "not-specified"  
   		},  
   		{  
   			"fieldKey": "3_arbeitseinkommen_name_der_person_2",  
   			"fieldType": "string",  
   			"fieldFormat": "not-specified"  
   		},  
   		{  
   			"fieldKey": "3_name_und_firmenanschrift_des_arbeitgebers_2",  
   			"fieldType": "string",  
   			"fieldFormat": "not-specified"  
   		},  
   		{  
   			"fieldKey": "3_gemeinnuetzige_oder_ehrenamtliche_taetigkeiten_ausgeuebt",  
   			"fieldType": "selectionMark",  
   			"fieldFormat": "not-specified"  
   		},  
   		{  
   			"fieldKey": "3_gemeinnuetzige_oder_ehrenamtliche_taetigkeiten_name_der_person",  
   			"fieldType": "string",  
   			"fieldFormat": "not-specified"  
   		},  
   		{  
   			"fieldKey": "3_gemeinnuetzige_oder_ehrenamtliche_taetigkeiten_art_der_taetigkeit",  
   			"fieldType": "string",  
   			"fieldFormat": "not-specified"  
   		},  
   		{  
   			"fieldKey": "3_gemeinnuetzige_oder_ehrenamtliche_taetigkeiten_zahlungseingang",  
   			"fieldType": "string",  
   			"fieldFormat": "not-specified"  
   		},  
   		{  
   			"fieldKey": "3_arbeitslosengeld_name_der_person",  
   			"fieldType": "string",  
   			"fieldFormat": "not-specified"  
   		},  
   		{  
   			"fieldKey": "3_renten_name_der_person_1",  
   			"fieldType": "string",  
   			"fieldFormat": "not-specified"  
   		},  
   		{  
   			"fieldKey": "3_renten_rentenart_der_person_1",  
   			"fieldType": "string",  
   			"fieldFormat": "not-specified"  
   		},  
   		{  
   			"fieldKey": "3_renten_name_der_person_2",  
   			"fieldType": "string",  
   			"fieldFormat": "not-specified"  
   		},  
   		{  
   			"fieldKey": "3_renten_rentenart_der_person_2",  
   			"fieldType": "string",  
   			"fieldFormat": "not-specified"  
   		},  
   		{  
   			"fieldKey": "3_unterhaltszahlungen_name_der_person_1",  
   			"fieldType": "string",  
   			"fieldFormat": "not-specified"  
   		},  
   		{  
   			"fieldKey": "3_unterhaltszahlungen_art_der_zahlung_der_person_1",  
   			"fieldType": "string",  
   			"fieldFormat": "not-specified"  
   		},  
   		{  
   			"fieldKey": "3_sonstige_laufende_einnahmen_name_der_person_1",  
   			"fieldType": "string",  
   			"fieldFormat": "not-specified"  
   		},  
   		{  
   			"fieldKey": "3_sonstige_laufende_einnahmen_einkommensart_1",  
   			"fieldType": "string",  
   			"fieldFormat": "not-specified"  
   		},  
   		{  
   			"fieldKey": "3_sonstige_laufende_einnahmen_name_der_person_2",  
   			"fieldType": "string",  
   			"fieldFormat": "not-specified"  
   		},  
   		{  
   			"fieldKey": "3_sonstige_laufende_einnahmen_einkommensart_2",  
   			"fieldType": "string",  
   			"fieldFormat": "not-specified"  
   		},  
   		{  
   			"fieldKey": "3_einmalige_und_unregelmaessige_einnahmen",  
   			"fieldType": "selectionMark",  
   			"fieldFormat": "not-specified"  
   		},  
   		{  
   			"fieldKey": "3_einmalige_und_unregelmaessige_einnahmen_name_der_person",  
   			"fieldType": "string",  
   			"fieldFormat": "not-specified"  
   		},  
   		{  
   			"fieldKey": "3_einmalige_und_unregelmaessige_einnahmen_einkommensart",  
   			"fieldType": "string",  
   			"fieldFormat": "not-specified"  
   		},  
   		{  
   			"fieldKey": "3_einmalige_und_unregelmaessige_einnahmen_einkommenshoehe",  
   			"fieldType": "string",  
   			"fieldFormat": "not-specified"  
   		},  
   		{  
   			"fieldKey": "3_einmalige_und_unregelmaessige_einnahmen_zahlungseingang_am",  
   			"fieldType": "string",  
   			"fieldFormat": "not-specified"  
   		},  
   		{  
   			"fieldKey": "4_absetzungen_vom_einkommen_haben_sich_geandert_name_der_person",  
   			"fieldType": "string",  
   			"fieldFormat": "not-specified"  
   		},  
   		{  
   			"fieldKey": "4_absetzungen_vom_einkommen_haben_sich_geandert_art_der_absetzung",  
   			"fieldType": "string",  
   			"fieldFormat": "not-specified"  
   		},  
   		{  
   			"fieldKey": "4_absetzungen_vom_einkommen_haben_sich_geandert_monatliche_hoehe_in_euro",  
   			"fieldType": "string",  
   			"fieldFormat": "not-specified"  
   		},  
   		{  
   			"fieldKey": "4_absetzungen_vom_einkommen_haben_sich_geandert_tag_der_aenderung",  
   			"fieldType": "string",  
   			"fieldFormat": "not-specified"  
   		},  
   		{  
   			"fieldKey": "5_eigentum_schuldzinsen_ohne_tilgungsrate",  
   			"fieldType": "string",  
   			"fieldFormat": "not-specified"  
   		},  
   		{  
   			"fieldKey": "5_eigentum_nebenkosten",  
   			"fieldType": "string",  
   			"fieldFormat": "not-specified"  
   		},  
   		{  
   			"fieldKey": "5_eigentum_heizkosten",  
   			"fieldType": "string",  
   			"fieldFormat": "not-specified"  
   		},  
   		{  
   			"fieldKey": "5_eigentum_sonstige_wohnkosten",  
   			"fieldType": "string",  
   			"fieldFormat": "not-specified"  
   		},  
   		{  
   			"fieldKey": "6_name_der_person_1",  
   			"fieldType": "string",  
   			"fieldFormat": "not-specified"  
   		},  
   		{  
   			"fieldKey": "6_tag_der_aenderung_1",  
   			"fieldType": "string",  
   			"fieldFormat": "not-specified"  
   		},  
   		{  
   			"fieldKey": "6_art_der_aenderung_1",  
   			"fieldType": "string",  
   			"fieldFormat": "not-specified"  
   		},  
   		{  
   			"fieldKey": "6_name_der_person_2",  
   			"fieldType": "string",  
   			"fieldFormat": "not-specified"  
   		},  
   		{  
   			"fieldKey": "6_tag_der_aenderung_2",  
   			"fieldType": "string",  
   			"fieldFormat": "not-specified"  
   		},  
   		{  
   			"fieldKey": "6_art_der_aenderung_2",  
   			"fieldType": "string",  
   			"fieldFormat": "not-specified"  
   		},  
   		{  
   			"fieldKey": "7_name_der_des_betreuten",  
   			"fieldType": "string",  
   			"fieldFormat": "not-specified"  
   		},  
   		{  
   			"fieldKey": "2_auszug_am",  
   			"fieldType": "string",  
   			"fieldFormat": "not-specified"  
   		},  
   		{  
   			"fieldKey": "3_selbststaendige_taetigkeit_name_der_person3_selbststaendige_taetigkeit_name_der_person",  
   			"fieldType": "string",  
   			"fieldFormat": "not-specified"  
   		},  
   		{  
   			"fieldKey": "3_sonstige_laufende_einnahmen_name_der_person_1",  
   			"fieldType": "selectionMark",  
   			"fieldFormat": "not-specified"  
   		},  
   		{  
   			"fieldKey": "5_miete_sonstige_wohnkosten",  
   			"fieldType": "selectionMark",  
   			"fieldFormat": "not-specified"  
   		},  
   		{  
   			"fieldKey": "3_unterhaltszahlungen_name_der_person_2",  
   			"fieldType": "string",  
   			"fieldFormat": "not-specified"  
   		},  
   		{  
   			"fieldKey": "3_unterhaltszahlungen_art_der_zahlung_der_person_2",  
   			"fieldType": "string",  
   			"fieldFormat": "not-specified"  
   		},  
   		{  
   			"fieldKey": "6_art_der_aenderung_2",  
   			"fieldType": "selectionMark",  
   			"fieldFormat": "not-specified"  
   		},  
   		{  
   			"fieldKey": "3_renten_name_der_person_1",  
   			"fieldType": "selectionMark",  
   			"fieldFormat": "not-specified"  
   		},  
   		{  
   			"fieldKey": "3_kindergeld",  
   			"fieldType": "selectionMark",  
   			"fieldFormat": "not-specified"  
   		},  
   		{  
   			"fieldKey": "4_absetzungen_vom_einkommen_haben_sich_geandert_nein",  
   			"fieldType": "selectionMark",  
   			"fieldFormat": "not-specified"  
   		},  
   		{  
   			"fieldKey": "5_ich_wohne_im_eigentum",  
   			"fieldType": "selectionMark",  
   			"fieldFormat": "not-specified"  
   		}  
   	],  
   	"definitions": {}  
   }  
Azure AI Document Intelligence
Azure AI Document Intelligence
An Azure service that turns documents into usable data. Previously known as Azure Form Recognizer.
1,480 questions
{count} votes

2 answers

Sort by: Most helpful
  1. K. B 6 Reputation points
    2022-11-30T09:00:49.36+00:00

    The WebGui doesnt give any more Error details than the screenshot i provided, but because of your comment i ran the same thing through the SDK and caught the Exception being thrown manually.
    It turns out that the Web GUI just doesnt provide the whole story:
    so apparently there is more than one error but formrecognizer studio just displays the first one?

       json  
       InvalidRequest: Invalid request.  
         
       Details:  
       ModelBuildError: Could not build the model: Cannot use fields.json; All labels are processed as normal key-value fields.  
       ModelBuildError: Could not build the model: fields.json contains duplicated FieldKey values.  
         
       Raw:  
       {  
           "code": "InvalidRequest",  
           "message": "Invalid request.",  
           "details": [  
             {  
               "code": "ModelBuildError",  
               "message": "Could not build the model: Cannot use fields.json; All labels are processed as normal key-value fields."  
             },  
             {  
               "code": "ModelBuildError",  
               "message": "Could not build the model: fields.json contains duplicated FieldKey values."  
             }  
           ]  
         }  
    

    The way to fix this issue for me was to:

    1. manually go into the fields.json file
    2. copy the content to vscode
    3. extract only the "fieldKey": "value" pairs
    4. run a find duplicate command
    5. go into the fields.json in the blob storage and manually delete all found duplicates
    6. success
    1 person found this answer helpful.

  2. Yardy, David 1 Reputation point
    2023-02-20T15:15:59.1066667+00:00

    I continue to get Cannot use fields.json; All labels are processed as normal key-value fields.

    0 comments No comments