BreezeWhite / oemer

End-to-end Optical Music Recognition (OMR) system. Transcribe phone-taken music sheet image into MusicXML, which can be edited and converted to MIDI.
https://breezewhite.github.io/oemer/
MIT License
386 stars 46 forks source link

parse_rhythm gives KeyError 5 #12

Closed howff closed 2 years ago

howff commented 2 years ago

The program failed with this error:

2022-09-22 13:47:37 Extracting rhythm types
Traceback (most recent call last):
  File "/src/omr/venv/bin/oemer", line 8, in <module>
    sys.exit(main())
  File "/src/omr/venv/lib/python3.8/site-packages/oemer/ete.py", line 267, in main
    mxl_path = extract(args)
  File "/src/omr/venv/lib/python3.8/site-packages/oemer/ete.py", line 189, in extract
    rhythm_extract()
  File "/src/omr/venv/lib/python3.8/site-packages/oemer/rhythm_extraction.py", line 596, in extract
    beam_img = parse_rhythm(out_map, map_info, agree_th=agree_th)
  File "/src/omr/venv/lib/python3.8/site-packages/oemer/rhythm_extraction.py", line 572, in parse_rhythm
    notes[nid].label = note_type_map[count]
KeyError: 5

I don't know if it's related but, before that, it gave some warnings

2022-09-22 13:47:29 Extracting stafflines
/src/omr/venv/lib/python3.8/site-packages/numpy/core/fromnumeric.py:3440: RuntimeWarning: Mean of empty slice.
  return _methods._mean(a, axis=axis, dtype=dtype,
/src/omr/venv/lib/python3.8/site-packages/numpy/core/_methods.py:189: RuntimeWarning: invalid value encountered in double_scalars
  ret = ret.dtype.type(ret / rcount)
82 282 283 483 1
484 684 1
685 885 2
886 1086 1
1087 1287 1
1288 1688 1
BreezeWhite commented 2 years ago

Most of the time when error occurs is due to the high complexity of the given music sheet, since the parsing algorithm is rule-based and thus exhibits lots of edges cases.

BreezeWhite commented 2 years ago

If you still have the problem using oemer, please file a new issue and follow the template format.