Initial support for automatic fixing of additional and wrong label

This commit is contained in:
2026-03-15 22:28:15 +01:00
parent 5f1613b8c1
commit f43c296e8a
11 changed files with 292 additions and 61 deletions
+3 -9
View File
@@ -142,10 +142,7 @@ def detect_checks_and_notes(output_dir):
from PIL import ImageDraw
import re
def natural_key(text):
return [int(c) if c.isdigit() else c.lower() for c in re.split(r'(\d+)', str(text))]
from utils import natural_key
from annotating import MARGIN_LEFT, ANNOT_WIDTH
def has_significant_notes(note_img, threshold=20):
@@ -324,7 +321,7 @@ def apply_actions_and_regenerate(root_dir, data, student_id, actions, notes_laye
print(f" Saved regenerated Concat_F.jpg")
from pathlib import Path
from utils import read_all_labelse
if __name__ == "__main__":
if len(sys.argv) < 2:
print("Usage: python reading_annotations.py <Dir>")
@@ -333,10 +330,7 @@ if __name__ == "__main__":
root_dir = sys.argv[1]
try:
all_labels = sorted(list(filter(None,
(Path(root_dir) / "labels")
.read_text().splitlines())),
key = natural_key)
all_labels = read_all_labels(Path(root_dir))
except FileNotFoundError:
all_labels = []