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
363 stars 42 forks source link

Model Training #39

Closed caesiummm closed 9 months ago

caesiummm commented 11 months ago

Describe the bug When I run train.py, I received the below error. I changed the main method into model training, using the ds dataset at first. But then, I keep receiving the error as mentioned below, I reckoned it has something to do with the class WarmUpLearningRate. Help me to solve the issue.

image

IMPORTANT The issue will be closed directly if you don't provide the image and the issue relates to transcription bugs.

Full Traceback Traceback (most recent call last): File "D:\OMR Project (9)-oemer\oemer-main\oemer\train.py", line 588, in model = train_model(dataset_path) ^^^^^^^^^^^^^^^^^^^^^^^^^ File "D:\OMR Project (9)-oemer\oemer-main\oemer\train.py", line 452, in train_model optim = tf.keras.optimizers.Adam(learning_rate=WarmUpLearningRate(learning_rate)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "D:\Python\Lib\site-packages\keras\src\optimizers\adam.py", line 122, in init self._learning_rate = self._build_learning_rate(learning_rate) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "D:\Python\Lib\site-packages\keras\src\optimizers\optimizer.py", line 1282, in _build_learning_rate return super()._build_learning_rate(learning_rate) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "D:\Python\Lib\site-packages\keras\src\optimizers\optimizer.py", line 385, in _build_learning_rate learning_rate(self.iterations) File "D:\OMR Project (9)-oemer\oemer-main\oemer\train.py", line 383, in call warm_lr = self.min_lr + self.warm_step_size * step


  File "D:\Python\Lib\site-packages\tensorflow\python\ops\variables.py", line 1013, in _run_op
    return tensor_oper(a.value(), *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\Python\Lib\site-packages\tensorflow\python\util\traceback_utils.py", line 153, in error_handler
    raise e.with_traceback(filtered_tb) from None
  File "D:\Python\Lib\site-packages\tensorflow\python\framework\constant_op.py", line 102, in convert_to_eager_tensor
    return ops.EagerTensor(value, ctx.device_name, dtype)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: Cannot convert 4.999899999999999e-07 to EagerTensor of dtype int64

**Command You Execute**
python train.py
3DThangs commented 10 months ago

Try running it with python3 train.py instead of python train.py Using python3 runs it with the python 3 interpreter, where as just python runs it as python 2.

liebharc commented 10 months ago

I hit the same issue as I looked into training, but at the time decided to ignore it as I was focusing on other parts. I used Python 3 so I don't think that's the issue. I was wondering if there was a change in Keras which causes that error, but it's a wild guess as I so far didn't find the time to look into this.