OMR_Tools
Some useful tools for Optical Mark Recognition (OMR). Note that only Python 3 is supported. There is no backward compatibility for Python 2 so you if you'd like to use Python 2, you'll have to make your own modifications.
Installation
First, get this repo and its submodules on your machine:
git clone --recursive git@github.com:jin-zhe/OMR_Tools.git
I recommend installing the necessary python packages via Conda which has become the de facto virtual environment manager for AI/ML projects (which this might potentially turn into). Conda also makes the installation process really simple because it is also a package-management system. If you rather not use Conda, you may refer to OMRChecker's original installation guide using pip
. Should you do that, just make sure you have the important packages listed under Packages.
Installing with Conda
- Follow this quickstart guide to install and understand how to use Conda
- Create a new Conda environment with necessary packages:
conda create -n omr_tools python=3.5 opencv matplotlib numpy pandas tqdm poppler -y
- Enter newly created environment
conda activate omr_tools
pip install pdf2image imutils
(these are the only two you have to install viapip
)
Packages
This repo has been tested to work with the following python package versions:
Package | Version |
---|---|
opencv |
v3.4.2 |
opencv-contrib-python |
4.2.0.32 |
matplotlib |
3.3.4 |
numpy |
1.19.2 |
pandas |
1.2.3 |
imutils |
0.5.4 |
tqdm |
4.56.0 |
pdf2image |
1.14.0 |
poppler |
0.81.0 |
PyPDF2 |
1.26.0 |
opencv-contrib-python
Submodules
As submodules are included in this repository, make sure you get the right one. If you didn't clone this repo with the --recursive
flag, you'll need to run:
git submodule update --init --recursive
OMRChecker
- Branch: extension-framework
- Commit:
'bc9310135602bfedf47c0db99ab60c5aae9935c4'
Scripts
stuID_checker.py
Conducts OMR on student exam script scans to determine their student ID.
Sample usage
python stuID_checker.py -i $script_dir -o output.csv -r
Arguments
Longform | Shortform | Optional | Description |
---|---|---|---|
--input-dir |
-i |
NO | Input directory containing script PDFs. |
--output |
-o |
NO | Output path for the CSV. |
--page |
-p |
YES | Specify the page to conduct OMR on (defaults to first). |
--rename |
-r |
YES | Flag for whether to rename documents based on their student numbers. |
---save-level |
-s |
YES | Specify saveimglvl of OMRChecker (defaults as 0 ). |
Related tools
Refer to this gist if you need a script to break up a pdf of multiple document scans (with same number of pages) into individual pdf doucments.