1.7 KiB
1.7 KiB
CLAUDE.md
Project
Accidental classifier — a small CNN that identifies sharp, flat, and natural symbols in cropped images of engraved music scores. Part of a larger OMR (optical music recognition) pipeline.
Key facts
- Model: 3-block CNN (16→32→64 channels), ~115k params, 1×40×40 grayscale input, 3-class output
- Dataset: Crops extracted from PrIMuS via Verovio rendering. ~5k per class after subsampling.
- Performance: 100% on held-out test set (750 samples). The three classes are visually distinct enough that this is a solved problem.
- Seed: 42. All splits use this seed for reproducibility.
- Split ratios: 5% test, 10% val, rest train (stratified)
- Labels:
["flat", "natural", "sharp"]— alphabetical order, indices 0/1/2
Layout
train.py— training pipeline, definesAccidentalCNNand all data loadingeval.py— evaluates saved checkpoint on the test split (imports from train.py)extract_accidentals.py— multi-font crop extraction from PrIMuS MEI filesextract_fast.py— faster single-font variantexplore_dataset.py— dataset statisticssegment_test.py— connected-component segmentation experimentmodel/accidental_classifier.pt— saved weightscrops/{flat,natural,sharp}/— extracted crops (gitignored)dataset/— raw PrIMuS data (gitignored)
Conventions
- All Python scripts use
sys.stdout.reconfigure(encoding="utf-8")for Windows compatibility - Hardcoded paths under
C:\src\accidentals\— this is a local workstation project - No requirements.txt; deps are PyTorch, torchvision, NumPy, Pillow, OpenCV, and optionally Verovio + cairosvg for extraction
Remote
- Gitea at
git.xml-pipeline.org/dullfig/accidentals, branchmain