Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature] Confidence metrics for thresholding + improve bar graphs for tuning #169

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
f9f6dc3
fix: typos and coherence (#164)
benfrstr Feb 16, 2024
26d27b8
fix: wip confidence
Udayraj123 Feb 17, 2024
4ef22d2
fix: wip refactor logic for field_bubbles_detection
Udayraj123 Feb 17, 2024
416cdeb
fix: wip core code done for confidence
Udayraj123 Feb 20, 2024
c8855ac
fix: add algorithms folder; fix runtime issues; add debug catch block
Udayraj123 Feb 20, 2024
834ca20
fix: convert maps to list comprehensions
Udayraj123 Feb 20, 2024
6e6acf2
fix: runtime issues
Udayraj123 Feb 20, 2024
11f6086
fix: debugging help
Udayraj123 Feb 20, 2024
c841c86
fix: add calculations wip
Udayraj123 Feb 21, 2024
aefe516
fix: improved constants handling and more metrics added
Udayraj123 Feb 23, 2024
1cfc03c
fix: wip 3d plot
Udayraj123 Feb 23, 2024
58e59aa
fix: wip
Udayraj123 Feb 24, 2024
c448e0c
feat: support for multiple-correct-weighted answer key (#166)
Udayraj123 Feb 24, 2024
a57830f
fix: get more args to plotter
Udayraj123 Feb 25, 2024
d1f8042
feat: add json serialisers to classes; create js importable data for …
Udayraj123 Feb 25, 2024
c423c9c
fix: typo
Udayraj123 Feb 25, 2024
a24ac47
feat: support for image metrics export to js
Udayraj123 Feb 29, 2024
14a3434
fix: conflicts
Udayraj123 Feb 29, 2024
f11752e
fix: move local_threshold to field
Udayraj123 Mar 1, 2024
d57aaa5
fix: export bubbles_in_doubt data; move local_threshold to field; ut…
Udayraj123 Mar 2, 2024
ece923a
fix: threshold hack
Udayraj123 Mar 2, 2024
4335547
fix: update snapshot for ambiguous bubble
Udayraj123 Mar 2, 2024
2f7f8a6
fix: keep author details in algorithm folder
Udayraj123 Mar 16, 2024
402f727
fix: conflict issues
Udayraj123 Mar 24, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ repos:
hooks:
- id: pytest-on-commit
name: Running single sample test
entry: pytest -rfpsxEX --disable-warnings --verbose -k sample1
entry: python3 -m pytest -rfpsxEX --disable-warnings --verbose -k sample1
language: system
pass_filenames: false
always_run: true
Expand All @@ -51,7 +51,7 @@ repos:
hooks:
- id: pytest-on-push
name: Running all tests before push...
entry: pytest -rfpsxEX --disable-warnings --verbose --durations=3
entry: python3 -m pytest -rfpsxEX --disable-warnings --verbose --durations=3
language: system
pass_filenames: false
always_run: true
Expand Down
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
# OMR Checker

Read OMRs fast and accurately using a scanner 🖨 or your phone 🤳.
Read OMR sheets fast and accurately using a scanner 🖨 or your phone 🤳.

## What is OMR?

OMR stands for Optical Mark Recognition, used to detect and interpret human-marked data on documents. OMR refers to the process of reading and evaluating OMR sheets, commonly used in exams, surveys, and other forms.

#### **Quick Links**
- [Installation](#getting-started)
Expand Down
18 changes: 12 additions & 6 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
from pathlib import Path

from src.entry import entry_point
from src.logger import logger
from src.utils.logger import logger


def parse_args():
Expand Down Expand Up @@ -88,12 +88,18 @@ def entry_point_for_args(args):
# Disable tracebacks
sys.tracebacklimit = 0
# TODO: set log levels

for root in args["input_paths"]:
entry_point(
Path(root),
args,
)
try:
entry_point(
Path(root),
args,
)
except Exception:
if args["debug"] is True:
logger.critical(
f"OMRChecker crashed. add --debug and run again to see error details"
)
raise


if __name__ == "__main__":
Expand Down
Binary file added samples/answer-key/using-csv/adrian_omr.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
q1,B
q1,C
q2,E
q3,A
q4,C
q4,B
q5,B
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"answer_key_csv_path": "answer_key.csv",
"should_explain_scoring": true
},
"marking_scheme": {
"marking_schemes": {
"DEFAULT": {
"correct": "1",
"incorrect": "0",
Expand Down
35 changes: 35 additions & 0 deletions samples/answer-key/using-csv/template.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{
"pageDimensions": [
300,
400
],
"bubbleDimensions": [
25,
25
],
"preProcessors": [
{
"name": "CropPage",
"options": {
"morphKernel": [
10,
10
]
}
}
],
"fieldBlocks": {
"MCQ_Block_1": {
"fieldType": "QTYPE_MCQ5",
"origin": [
65,
60
],
"fieldLabels": [
"q1..5"
],
"labelsGap": 52,
"bubblesGap": 41
}
}
}
35 changes: 35 additions & 0 deletions samples/answer-key/weighted-answers/evaluation.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{
"source_type": "custom",
"options": {
"questions_in_order": [
"q1..5"
],
"answers_in_order": [
"C",
"E",
[
"A",
"C"
],
[
[
"B",
2
],
[
"C",
"3/2"
]
],
"C"
],
"should_explain_scoring": true
},
"marking_schemes": {
"DEFAULT": {
"correct": "3",
"incorrect": "-1",
"unmarked": "0"
}
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
35 changes: 35 additions & 0 deletions samples/answer-key/weighted-answers/template.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{
"pageDimensions": [
300,
400
],
"bubbleDimensions": [
25,
25
],
"preProcessors": [
{
"name": "CropPage",
"options": {
"morphKernel": [
10,
10
]
}
}
],
"fieldBlocks": {
"MCQ_Block_1": {
"fieldType": "QTYPE_MCQ5",
"origin": [
65,
60
],
"fieldLabels": [
"q1..5"
],
"labelsGap": 52,
"bubblesGap": 41
}
}
}
2 changes: 1 addition & 1 deletion samples/community/UPSC-mock/evaluation.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
],
"should_explain_scoring": true
},
"marking_scheme": {
"marking_schemes": {
"DEFAULT": {
"correct": "2",
"incorrect": "-2/3",
Expand Down
4 changes: 2 additions & 2 deletions samples/community/UmarFarootAPS/answer_key.csv
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ q1,C
q2,C
q3,"D,E"
q4,"A,AB"
q5,"['A', ['1', '-2/3', '0']]"
q6,"['A', ['2']]"
q5,"[['A', '1'], ['B', '2']]"
q6,"['A', 'B']"
q7,C
q8,D
q9,B
Expand Down
2 changes: 1 addition & 1 deletion samples/community/UmarFarootAPS/evaluation.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"answer_key_csv_path": "answer_key.csv",
"should_explain_scoring": true
},
"marking_scheme": {
"marking_schemes": {
"DEFAULT": {
"correct": "1",
"incorrect": "0",
Expand Down
8 changes: 6 additions & 2 deletions samples/sample4/evaluation.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,19 @@
"B",
"D",
"C",
"BC",
[
"B",
"C",
"BC"
],
"A",
"C",
"D",
"C"
],
"should_explain_scoring": true
},
"marking_scheme": {
"marking_schemes": {
"DEFAULT": {
"correct": "3",
"incorrect": "-1",
Expand Down
2 changes: 1 addition & 1 deletion samples/sample5/evaluation.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
],
"should_explain_scoring": true
},
"marking_scheme": {
"marking_schemes": {
"DEFAULT": {
"correct": "1",
"incorrect": "0",
Expand Down
2 changes: 1 addition & 1 deletion src/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# https://docs.python.org/3/tutorial/modules.html#:~:text=The%20__init__.py,on%20the%20module%20search%20path.
from src.logger import logger
from src.utils.logger import logger

# It takes a few seconds for the imports
logger.info(f"Loading OMRChecker modules...")
Empty file added src/algorithm/__init__.py
Empty file.
Loading