I'm about to start a project with the objective to classify PDF-documents. I'm wondering if there's a best practice approach to tackle this problem.

Concretely I'm wondering if one of the following two approaches performs usually better:

  1. use an OCR reader to convert the files to text and train the classifier model on the text data
  2. convert the files to images and train a CNN classifier model

I'm planning to classify different testimonials and certificates mostly. Since most of these files share a similar layout and text within the classes the ideas should both work out. I'm wondering if anybody has already made experience with this and could tell me about some advantages/disadvantages when using a specific approach.

I'd highly appreciate any kind of help.

  • $\begingroup$ Depending on the pdf generation method, sometimes you can directly get text from pdf. $\endgroup$ Jan 9, 2020 at 13:22

1 Answer 1


Both methods will be beneficial for different cases.

If you think that dependencies in the text are more discriminative of the classes, then NLP apporach. Image approach in this case will need to be super complex to catch this kind of information.

On the other hand layout and position could be very informative and this it could happen is not encoded in text and only image approach can catch this information.

Conclusion. Maybe think about hard-encoding layout and position features and pass them along to NLP model.

  • $\begingroup$ Thank you for taking your time to answer this question. I'm not entirely sure if I understood you correctly. Could you give me an example for hard-encoding a layout? $\endgroup$ Jan 9, 2020 at 16:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.