forked from meteo-team/oemer
-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make training of segnet, unet and classifiers easier by providing a s…
…ingle entry point to all training steps (#54) * Fixed 'TypeError: Cannot convert 4.999899999999999e-07 to EagerTensor of dtype int64' in training, fixes #39 https://stackoverflow.com/questions/76511182/tensorflow-custom-learning-rate-scheduler-gives-unexpected-eagertensor-type-erro * --format was deprecated in ruff and replaced wtih --output-format * Added a single entry point to train all models * Added convenience wrapper for oemer * Tried to figure out the definitions for the dense dataset and to document them in code There is likely an official definition somewhere but I just couldn't find it. So I looked at example and tried to reconstruct the mapping. Unknown basically means that I just couldn't see the symbol on the picture. * Decreased queue sizes as otherwise the training process crashed with an out of memory exception after it used up about 30GB of memory * Added model outputs to git ignore * Added checks for dataset folders * Using default training params * Added workarounds for removal of np.float * Using dataset definitions * Added type annotations * Added a train_all_rests even if the resulting model is right now not used in oemer * segnet and unet should now pick the correct model * Changed label definitions from what appears to be used in oemer right now * With this commit the resulting arch.json matches the one inside of oemer/ceckpoints/seg_net/arch.json * Avoid that the OMR processes finishes prematurely (#53) * Fixed typos in comments * IndexError while scanning for a dot should not abort the whole process * Bound check while getting the note label * Added check if label is in the note_type_map * Filter staffs instead of aborting with an exception * Bound check during symbol extraction * Marking notes as invalid instead of aborting with an exception * Bound check * Fixed type error * Fixed TypeError at start of unet or segnet training (#52) * Fixed 'TypeError: Cannot convert 4.999899999999999e-07 to EagerTensor of dtype int64' in training, fixes #39 https://stackoverflow.com/questions/76511182/tensorflow-custom-learning-rate-scheduler-gives-unexpected-eagertensor-type-erro * --format was deprecated in ruff and replaced wtih --output-format * HoughLinesP can return None if no lines are found * Fixed error which happens if no rest bboxes were found * Limited try/except block * Fixed typo * Use fixed versions for the linter dependencies to avoid that results are different for the same source code level on different test runs due to update of the dependencies * Fixed type errors which came up with the recent version of cv2 * Going back to the newest version of ruff and mypy as the type errors were introduced by cv2 * Fix install from github command in README --------- Co-authored-by: Yoyo <[email protected]>
- Loading branch information
1 parent
681d5df
commit 072b69e
Showing
10 changed files
with
376 additions
and
124 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
from oemer import ete | ||
|
||
ete.main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
class Symbols: | ||
BACKGROUND = [0] | ||
LEDGERLINE = [2] | ||
BARLINE_BETWEEN = [3] | ||
BARLINE_END = [4] | ||
ALL_BARLINES = BARLINE_BETWEEN + BARLINE_END | ||
REPEAT_DOTS = [7] | ||
G_GLEF = [10] | ||
C_CLEF = [11, 12] | ||
F_CLEF = [13] | ||
ALL_CLEFS = G_GLEF + C_CLEF + F_CLEF | ||
NUMBERS = [19, 20] | ||
TIME_SIGNATURE_SUBSET = [21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 33, 34] | ||
TIME_SIGNATURE = TIME_SIGNATURE_SUBSET + [31, 32] # Oemer hasn't used these in the past | ||
NOTEHEAD_FULL_ON_LINE = [35] | ||
UNKNOWN = [36, 38, 40, 128, 143, 144, 148, 150, 157, 159, 160, 161, 162, 163, 164, 167, 170, 171] | ||
NOTEHEAD_FULL_BETWEEN_LINES = [37] | ||
NOTEHEAD_HOLLOW_ON_LINE = [39] | ||
NOTEHEAD_HOLLOW_BETWEEN_LINE = [41] | ||
WHOLE_NOTE_ON_LINE = [43] | ||
WHOLE_NOTE_BETWEEN_LINE = [45] | ||
DOUBLE_WHOLE_NOTE_ON_LINE = [47] | ||
DOUBLE_WHOLE_NOTE_BETWEEN_LINE = [49] | ||
NOTEHEADS_SOLID = NOTEHEAD_FULL_ON_LINE + NOTEHEAD_FULL_BETWEEN_LINES | ||
NOTEHEADS_HOLLOW = NOTEHEAD_HOLLOW_ON_LINE + NOTEHEAD_HOLLOW_BETWEEN_LINE | ||
NOTEHEADS_WHOLE = WHOLE_NOTE_ON_LINE + WHOLE_NOTE_BETWEEN_LINE + DOUBLE_WHOLE_NOTE_ON_LINE + DOUBLE_WHOLE_NOTE_BETWEEN_LINE | ||
NOTEHEADS_ALL = NOTEHEAD_FULL_ON_LINE + NOTEHEAD_FULL_BETWEEN_LINES + NOTEHEAD_HOLLOW_ON_LINE + NOTEHEAD_HOLLOW_BETWEEN_LINE + WHOLE_NOTE_ON_LINE + WHOLE_NOTE_BETWEEN_LINE + DOUBLE_WHOLE_NOTE_ON_LINE + DOUBLE_WHOLE_NOTE_BETWEEN_LINE | ||
DOT = [51] | ||
STEM = [52] | ||
TREMOLO = [53, 54, 55, 56] | ||
FLAG_DOWN = [58, 60, 61, 62, 63] | ||
FLAG_UP = [64, 66, 67, 68, 69] | ||
FLAT = [70] | ||
NATURAL = [72] | ||
SHARP = [74] | ||
DOUBLE_SHARP = [76] | ||
ALL_ACCIDENTALS = FLAT + NATURAL + SHARP + DOUBLE_SHARP | ||
KEY_FLAT = [78] | ||
KEY_NATURAL = [79] | ||
KEY_SHARP = [80] | ||
ALL_KEYS = KEY_FLAT + KEY_NATURAL + KEY_SHARP | ||
ACCENT_ABOVE = [81] | ||
ACCENT_BELOW = [82] | ||
STACCATO_ABOVE = [83] | ||
STACCATO_BELOW = [84] | ||
TENUTO_ABOVE = [85] | ||
TENUTO_BELOW = [86] | ||
STACCATISSIMO_ABOVE = [87] | ||
STACCATISSIMO_BELOW = [88] | ||
MARCATO_ABOVE = [89] | ||
MARCATO_BELOW = [90] | ||
FERMATA_ABOVE = [91] | ||
FERMATA_BELOW = [92] | ||
BREATH_MARK = [93] | ||
REST_LARGE = [95] | ||
REST_LONG = [96] | ||
REST_BREVE = [97] | ||
REST_FULL = [98] | ||
REST_QUARTER = [99] | ||
REST_EIGHTH = [100] | ||
REST_SIXTEENTH = [101] | ||
REST_THIRTY_SECOND = [102] | ||
REST_SIXTY_FOURTH = [103] | ||
REST_ONE_HUNDRED_TWENTY_EIGHTH = [104] | ||
ALL_RESTS_EXCEPT_LARGE = REST_LONG + REST_BREVE + REST_FULL + REST_QUARTER + REST_EIGHTH + REST_SIXTEENTH + REST_THIRTY_SECOND + REST_SIXTY_FOURTH + REST_ONE_HUNDRED_TWENTY_EIGHTH | ||
ALL_RESTS = ALL_RESTS_EXCEPT_LARGE | ||
TRILL = [127] | ||
GRUPPETO = [129] | ||
MORDENT = [130] | ||
DOWN_BOW = [131] | ||
UP_BOW = [132] | ||
SYMBOL = [133, 134, 135, 138, 139, 141, 142] | ||
TUPETS = [136, 137, 149, 151, 152, 153, 154, 155, 156] | ||
SLUR_AND_TIE = [145, 147] | ||
BEAM = [146] | ||
STAFF = [165] | ||
|
||
DENSE_DATASET_DEFINITIONS = Symbols() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.