How liebharc/homr works
homr converts sheet-music images or PDFs into MusicXML through image segmentation, staff reconstruction, and transformer-based symbol recognition. The README documents the pipeline stages and capabilities; the sampled source confirms the CLI orchestration entry point, inference components, decoder behavior, and web wrapper. Some wiring is documented rather than visible in the partial excerpts, so the graph omits uncertain helper-level relationships.
Main entry points: main.py CLI orchestrator · app.py Web upload API · music_xml_generator.py MusicXML generation · pdf_utils.py PDF conversion
Components 21
Entry points
- CLI orchestrator
homr/main.py - Web upload API
docker/web/app.py
Image structure
- Image preparation
homr/image_utils.py - PDF conversion
homr/pdf_utils.py - Segmentation inference
homr/segmentation/inference_segnet.py - Element boxes
homr/bounding_boxes.py - Staff detection
homr/staff_detection.py - Staff anchors
homr/staff_regions.py - Staff merging
homr/brace_dot_detection.py - Staff dewarping
homr/staff_dewarping.py
Symbol recognition
- Transformer encoder
homr/transformer/encoder_inference.py - Symbol decoder
homr/transformer/decoder_inference.py - Symbol vocabulary
homr/transformer/vocabulary.py - Staff-to-score conversion
homr/transformer/staff2score.py
MusicXML output
- MusicXML generation
homr/music_xml_generator.py - MusicXML file
- Score combining
homr/relieur.py
Other components
- CLI user
- Web user
- Image or PDF
- MusicXML tools
Connections 23
- CLI user → CLI orchestrator: runs
- CLI orchestrator → Image or PDF: reads
- CLI orchestrator → PDF conversion: converts PDFs
- PDF conversion → Image preparation: provides image
- CLI orchestrator → Image preparation: prepares image
- CLI orchestrator → Segmentation inference: runs inference
- Segmentation inference → Element boxes: yields regions
- CLI orchestrator → Staff detection: detects staffs
- Staff detection → Staff anchors: uses anchors
- CLI orchestrator → Staff merging: merges staffs
- CLI orchestrator → Staff dewarping: corrects perspective
- CLI orchestrator → Transformer encoder: encodes staff
- Transformer encoder → Symbol decoder: supplies features
- Symbol decoder → Symbol vocabulary: decodes tokens
- CLI orchestrator → Staff-to-score conversion: converts symbols
- Staff-to-score conversion → MusicXML generation: provides score
- CLI orchestrator → MusicXML generation: writes output
- MusicXML generation → MusicXML file: saves
- MusicXML file → MusicXML tools: opens
- Web user → Web upload API: uploads score
- Web upload API → CLI orchestrator: invokes conversion
- Web upload API → MusicXML file: returns file
- CLI orchestrator → Score combining: combines inputs