AWS document classifier only working with < a certain number of documents

I really appreciate anyone being willing to help. Just to refresh, this is the blog post I’ve been following: This is the link to the blog I have been following along with: https://aws.amazon.com/blogs/machine-learning/intelligently-split-multi-form-document-packages-with-amazon-textract-and-amazon-comprehend/ -

and the github - https://github.com/aws-samples/aws-document-classifier-and-splitter/

So since my original post I was able to get the state machine to actually work and stop looping, but only when I significantly lowered the number of multi-page pdf’s I was giving it from S3 in order to build the DynamoDB table. My company has 130+ different document types we would like to classify. When the state machine was failing originally, it seems to be because I was giving it ~3500 multi-page pdf’s. I dont know why, but it was looping between check table status → is table complete → wait for object processing. If you look through the function code, it seems that in function 4, the check to see if the table is full is

if rows_not_filled == 0:
        return True
    else:
        return False

Even when the table was full (I was able to look through the table for any empty rows), it seemed to be returning False. So I think I am being throttled somewhere by DynamoDB or Textract, but I don’t know where, and I don’t know how to fix this issue. I believe I have tried both on-demand as well as provisioned capacity options for the table, but get the same error when I try to feed too many documents to the application. I am pleading for someone to help me. I cannot pay for help. I just want someone to tell me what could be wrong with what i’m doing. I am almost positive that it is some capacity issue but I am so lost and don’t know what to do in order to be able to troubleshoot the issue.

Looking at the code, an unfilled row in Dynamo counts as one where the “class” attribute does not exist, so there must be one or more rows where this isn’t the case.

Whenever a row is is inserted into Dynamo, function 3 (processobjectsandupdaterows) will be triggered via a Dynamo stream. This function is what calls Textract and ultimately sets the “class” attribute once it receives a response, so you should look at the CloudWatch logs/metrics for this function to see if there are any errors.

At the end of the day, if you can’t find the root cause of the problem but it still works for a small number of files, could you work around the issue by just writing a script to drip feed the files into S3 rather than dumping them all in at once?

The last paragraph is what i’ve been looking into, but i don’t know how i would be able to get them into the same classifier if i did it in batches…any ideas?

Ah yes, good point about needing them all to be processed together to feed into the same classifier. Thinking about it a bit more, drip feeding wouldn’t work with the existing state machine anyway since it just takes a snapshot of the files at a point in time - you’d have to change the architecture a bit to allow for that.

So leaving a workaround to one side for a minute and going back to the troubleshooting, what do the logs/metrics of function 3 say?

When you say there are no unfilled rows, you mean every row has the “class” attribute set? Can you write some code or use the CLI to replicate the query function 3 is making to be absolutely sure?

i can’t see the logs of the function itself because it says it’s part of an application :confused: so idk where i can look more deeply at the actual function logs

I sent you a DM as wwll