I know classifying images using cnn but I have a problem where I have multiple types of scanned documents in a pdf file on different pages. Some types of scanned documents present in multiple pages inside the pdf.

Now I have to classify and return which documents are present and the page numbers in which they present in the pdf document. If scanned document is in multiple pages I should return the range of page numbers like "1 - 10".

Input will be pdf files containing scanned target documents

Output should be classified "Document Name" and Its "page numbers"

Can any one guide me on how can I a build a model that can address this problem.


  • $\begingroup$ Do you have training data with known targets (type of doc) or is this a unsupervized problem? $\endgroup$
    – Peter
    Aug 27, 2021 at 15:06
  • $\begingroup$ This is an unsupervised problem, I only had pdf files with images in them $\endgroup$
    – Sherlock
    Aug 30, 2021 at 5:37
  • $\begingroup$ Did you check pagewise topic modeling? $\endgroup$
    – Peter
    Aug 30, 2021 at 11:17
  • $\begingroup$ No I am new to this topic $\endgroup$
    – Sherlock
    Aug 30, 2021 at 11:20

1 Answer 1


Since this is a unsupervized problem, you need to try to extract "topics" using topic modeling. There are a number of tools available in Python, e.g. from sklearn or spacy.

Basic workflow:

  • Extract text from PDF
  • Text preprocessing (lowercase, stemming etc)
  • Topic modeling
  • Return "topic" per page
  • $\begingroup$ so classification should be on topic text...but we have some features like logos and company names, tables in the pdf pages...which might help in classification $\endgroup$
    – Sherlock
    Aug 30, 2021 at 13:22
  • $\begingroup$ I don’t think that you can do both text and image classification in one model (i.e. in an unsupervized setting). However, you could see if you can train a second model on images/logos and combine the output of the two models. $\endgroup$
    – Peter
    Aug 30, 2021 at 16:24

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.