BreezeWhite/oemer

parse_rhythm gives KeyError 5

Closed this issue · 2 comments

howff commented

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

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.

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