Code Monkey home page Code Monkey logo

yte9pc / internet-archive-pdf-capstone Goto Github PK

View Code? Open in Web Editor NEW
6.0 2.0 2.0 3.86 MB

UVA Data Science Capstone project for Internet Archive. This project aimed to classify PDFs as research or non-research documents using an image and text-based approach. For the image-based models, we leveraged CNN transfer learning and used XGBoost for text-based approach.

Jupyter Notebook 96.07% Python 3.93%
pdf pymupdf pipeline cnn-classification image-processing tensorflow internet-archive deep-learning transfer-learning

internet-archive-pdf-capstone's Introduction

Internet-Archive-PDF

Problem Description

As new effort in our mission towards “Universal Access to All Knowledge”, the Internet Archive is attempting to collect and provide perpetual access to the “scholarly web”: the public record of research publications and datasets available on the world wide web, interlinked by both hyperlinks (URLs) and citations. We have a specific focus on “long-tail” open access works (which may be published in non-English language, outside North America or Europe, in nonSTEM disciplines, from small or informal publishers, not assigned DOIs, not archived in existing preservation networks, etc).

Implementation and training of a fast PDF identification tool, which can score files on their likelihood of being a research publication, and what stage of publication (eg, abstract, manuscript, camera ready, OCR scan) the file represents. Ideally the tool would process hundreds of millions of files and be network (as opposed to CPU) bound.

Environment

  • Python Version 3.7.4
  • Tensorflow Version 2.3.1
  • Keras Version 2.4.3

How To

To run the text based approach follow these steps

  • First run createDB.py or download googletranslate.db
    • Recommend downloading googletranslate.db
  • Second run multiprocessingMetaText.py
    • python multiprocessingMetaText.py -d "path to input directory of pdfs" -o "path to output directory to store csv" -f "file name to save as (needs to be pkl)" -p "# of processes to use (or let the script decide)"
      • This script will call metaText.py and create a dataset that is used for the model

To run the image based approach follow these steps

  • First run multiprocessingPDFtoImages.py
    • python multiprocessingMetaText.py -d "path to input directory of pdfs" -o "path to output directory to store png" -p "# of processes (or let the script decide)"
      • This script will call pdfToImage.py and create an image of the first page of each PDF
  • Second if a VGG16_V4 model does not exist create a training data set and run cnn.py else skip this step
    • Modify line 52 to point to training set
    • python cnn.py
      • This will train a VGG16 model and save the model
  • Third run multiprocessingCNNPredict.py
    • Modify line 15 in cnnPredict.py to point to saved model
    • python multiprocessingCNNPredict.py -d "path to png files" -o "path to save result" -f "resultName.csv" -p "# of processes (or let the script decide)"
      • This script will call cnnPredict.py and return a csv file with the prediction of each PDF

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.