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] Support for conditional sets in evaluation + Autorotation + minor features #192

Merged
merged 22 commits into from
Sep 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,4 @@ outputs/*
**/__pycache__
venv/
OMRChecker.wiki/
pytestdebug.log
8 changes: 4 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ repos:
hooks:
- id: convert-images
name: Convert png to jpg in samples
entry: scripts/convert_images_hook.py
entry: scripts/hooks/convert_images_hook.py
args: ["--trigger-size", "150"]
files: ^samples.*\.(png|PNG)$
pass_filenames: true
Expand All @@ -22,7 +22,7 @@ repos:
hooks:
- id: resize-images
name: Resize images
entry: scripts/resize_images_hook.py
entry: scripts/hooks/resize_images_hook.py
args: ["--max-width", "1500", "--max-height", "1500", "--trigger-size", "150"]
files: \.(png|jpg|jpeg|PNG|JPG|JPEG)$
pass_filenames: true
Expand Down Expand Up @@ -93,7 +93,7 @@ repos:
hooks:
- id: pytest-on-commit
name: Running single sample test
entry: python3 -m pytest -rfpsxEX --disable-warnings --verbose -k test_run_omr_marker_mobile
entry: python3 -m pytest -rfpsxEX --disable-warnings -vv -k test_run_omr_marker_mobile
language: system
pass_filenames: false
always_run: true
Expand All @@ -103,7 +103,7 @@ repos:
hooks:
- id: pytest-on-push
name: Running all tests before push...
entry: python3 -m pytest -rfpsxEX --disable-warnings --verbose --durations=3
entry: python3 -m pytest -rfpsxEX --disable-warnings -vv --durations=3
language: system
pass_filenames: false
always_run: true
Expand Down
5 changes: 3 additions & 2 deletions conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
image_snapshot_fixture,
image_snapshot_parser_hook,
)
from src.tests.__fixtures__.run_sample import run_sample_fixture
from src.tests.__fixtures__.run_sample import run_sample_fixture, run_sample_parser_hook


# Register a custom image_snapshot fixture
Expand All @@ -22,4 +22,5 @@ def run_sample(request):

# Add hook
def pytest_addoption(parser):
return image_snapshot_parser_hook(parser)
run_sample_parser_hook(parser)
image_snapshot_parser_hook(parser)
6 changes: 3 additions & 3 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ screeninfo==0.8.1
scipy==1.12.0
shapely==2.0.3
# Note: opencv is excluded from requirements.txt because the installation steps
# may be different as per your OS. Windows/MacOS users can uncomment the following
# opencv-python==4.9.0.80
# opencv-contrib-python==4.9.0.80
# may be different as per your OS. Linux users may want to comment the following two lines
opencv-python==4.9.0.80
opencv-contrib-python==4.9.0.80
3 changes: 2 additions & 1 deletion samples/2-omr-marker/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"display_image_dimensions": [
2400,
1800
]
],
"colored_outputs_enabled": true
}
}
2 changes: 1 addition & 1 deletion samples/2-omr-marker/evaluation.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"source_type": "custom",
"source_type": "local",
"options": {
"questions_in_order": [
"q1..22"
Expand Down
Binary file added samples/2-omr-marker/reference.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions samples/2-omr-marker/template.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@
40
],
"preProcessors": [
{
"name": "AutoRotate",
"options": {
"referenceImage": "reference.jpg"
}
},
{
"name": "CropOnMarkers",
"options": {
Expand Down
3 changes: 2 additions & 1 deletion samples/3-answer-key/bonus-marking-grouping/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
1682
],
"filter_out_multimarked_files": false,
"show_image_level": 0
"show_image_level": 0,
"colored_outputs_enabled": true
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"source_type": "custom",
"source_type": "local",
"options": {
"questions_in_order": [
"q1..11"
Expand Down
2 changes: 1 addition & 1 deletion samples/3-answer-key/bonus-marking/evaluation.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"source_type": "custom",
"source_type": "local",
"options": {
"questions_in_order": [
"q1..11"
Expand Down
6 changes: 6 additions & 0 deletions samples/3-answer-key/conditional-sets/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"outputs": {
"show_image_level": 0,
"colored_outputs_enabled": true
}
}
105 changes: 105 additions & 0 deletions samples/3-answer-key/conditional-sets/evaluation.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
{
"source_type": "local",
"options": {
"questions_in_order": [
"q1..20"
],
"answers_in_order": [
"B",
"D",
"C",
"B",
"D",
"B",
"D",
"C",
"B",
"D",
"01",
"02",
"11",
"21",
"31",
"41",
"51",
"61",
"71",
"81"
]
},
"outputs_configuration": {
"draw_score": {
"enabled": true,
"position": [
650,
750
],
"size": 1.5
},
"draw_answers_summary": {
"enabled": true,
"position": [
650,
820
],
"size": 0.85
},
"should_explain_scoring": true
},
"marking_schemes": {
"DEFAULT": {
"correct": "3",
"incorrect": "0",
"unmarked": "0"
},
"MR_INCREDIBLE": {
"marking": {
"correct": 4,
"incorrect": 0,
"unmarked": 0
},
"questions": [
"q1..3"
]
},
"BONUS_MARKS_ON_ATTEMPT": {
"marking": {
"correct": "3",
"incorrect": "3",
"unmarked": "0"
},
"questions": []
},
"BONUS_MARKS_FOR_ALL": {
"marking": {
"correct": "3",
"incorrect": "3",
"unmarked": "3"
},
"questions": []
}
},
"conditional_sets": [
{
"name": "Set A",
"matcher": {
"formatString": "{q21}",
"matchRegex": "A"
},
"evaluation": {
"source_type": "local",
"options": {
"answers_in_order": [],
"questions_in_order": []
},
"marking_schemes": {
"DEFAULT": {
"correct": "4",
"incorrect": "0",
"unmarked": "0"
}
}
}
}
]
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added samples/3-answer-key/conditional-sets/set-1.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added samples/3-answer-key/conditional-sets/set-2.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading