accidentals/CLAUDE.md
dullfig 17bed20d00 Add CLAUDE.md project context
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-02 08:05:41 -08:00

1.7 KiB
Raw Blame History

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, defines AccidentalCNN and all data loading
  • eval.py — evaluates saved checkpoint on the test split (imports from train.py)
  • extract_accidentals.py — multi-font crop extraction from PrIMuS MEI files
  • extract_fast.py — faster single-font variant
  • explore_dataset.py — dataset statistics
  • segment_test.py — connected-component segmentation experiment
  • model/accidental_classifier.pt — saved weights
  • crops/{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, branch main