Azure Form Recognizer Invalid ModelID

kushala gajengi 21 Reputation points
2020-09-13T16:23:21.607+00:00

Form Recognizer API (v2.0)
Form - Train Custom Model

I m trying to train the model using below Rest API URL

Request URL :https://westeurope.api.cognitive.microsoft.com/formrecognizer/v2.0/custom/models

Passing the following Headers:
Ocp-Apim-Subscription-Key: API Key
Content-Type :application/json

Added the file in Blob Container, Generated SAS URL with read & list option, able to access the SAS URL when trying through browser, but modelID is generating with invalid status when passing to the Rest API.

SAS URL : Container name is mentioned with the URL, since I have directly added the file in root so prefix parameter is blank.

{
"source": "https://europestorage27.blob.core.windows.net/eurcontainer/europestorage27/test.pdf?sp=r&st=2020-09-13T15:36:24Z&se=2020-09-13T23:36:24Z&spr=https&sv=2019-12-12&sr=b&sig=jtvogkhFQ9%2FCZOAkTBDxbrV8mwFBOByicB4Z3XY8aGg%3D",
"sourceFilter": {
"prefix": "",
"includeSubFolders": false
},
"useLabelFile": false
}

When i list the models, I get the status of ModelID in invalid status

{
"modelId": "modelIdgenerated",
"status": "invalid",
"createdDateTime": "2020-09-13T15:15:39Z",
"lastUpdatedDateTime": "2020-09-13T15:15:39Z"
}

Request to provide some solution on the issue.

Azure Form Recognizer
Azure Form Recognizer
An Azure service that applies machine learning to extract text, key/value pairs, tables, and structures from documents.
643 questions
{count} votes

Accepted answer
  1. romungi-MSFT 27,106 Reputation points Microsoft Employee
    2020-09-17T14:11:16.077+00:00

    @kushala gajengi When you post the train request the API takes the parameters and creates a train operation with a model id and training result can go into any state based on the training outcome. In this case the training of your document is failing so the model id is displaying an invalid status. I would suggest to modify your train request body to something similar. The current request you are using is not passing any filters and you are using the complete SAS URL.

    {  
      "source": "https://<yourcontainer>.blob.core.windows.net/test/",  
      "sourceFilter": {  
        "prefix": "exam_form",  
        "includeSubFolders": false  
      },  
      "useLabelFile": false  
    }  
    

    In the above example my container name is test and my set of training forms are of prefix exam_form. This will ensure all the forms starting with this prefix are used for training and once you list the model it should display the status of training against each of this file and if the training is successful the model status would be ready.


0 additional answers

Sort by: Most helpful