Git Product home page Git Product logo

classical-piano-composer's Introduction

Classical Piano Composer

This project allows you to train a neural network to generate midi music files that make use of a single instrument

Requirements

  • Python 3.x
  • Installing the following packages using pip:
    • Music21
    • Keras
    • Tensorflow
    • h5py

Training

To train the network you run lstm.py.

E.g.

python lstm.py

The network will use every midi file in ./midi_songs to train the network. The midi files should only contain a single instrument to get the most out of the training.

NOTE: You can stop the process at any point in time and the weights from the latest completed epoch will be available for text generation purposes.

Generating music

Once you have trained the network you can generate text using predict.py

E.g.

python predict.py

You can run the prediction file right away using the weights.hdf5 file

classical-piano-composer's People

Contributors

elsehow avatar katacka avatar skuldur avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

classical-piano-composer's Issues

Do you have any idea about how to handle multiple instrument or orchestration?

Hi Skuldur,
Thanks for your great job.
I want to create a tool that take a melody as input (a piano midi for example) and output with many instrument like symphony.
Maybe we can have two midi file, one of single instrument and another have many instrument. Using the first one as input sequence and second one as output sequence. Perhaps like translation?

Do you think that works? Any idea will appreciate. Thank you.

Orchestral Music

Hi there!

The neural network works brilliantly,
Thanks you a lot.

But...

It only makes piano pattern

Could it also make the full orchestra music with strings, winds and percussion?

And if it could, HOW?!

Error when training

Whenever I run the training script, even using the original training data, I get the following error:
TypeError: expected 0 arguments, got 1
Here is the full output:
Warning (from warnings module):
File "E:\Python\3.6.2\lib\site-packages\h5py_init_.py", line 36
from .conv import register_converters as register_converters
FutureWarning: Conversion of the second argument of issubdtype from float to np.floating is deprecated. In future, it will be treated as np.float64 == np.dtype(float).type.
Using TensorFlow backend.
Traceback (most recent call last):
File "E:\Python\Projects\Classical-Piano-Composer-master\lstm.py", line 121, in
train_network()
File "E:\Python\Projects\Classical-Piano-Composer-master\lstm.py", line 17, in train_network
notes = get_notes()
File "E:\Python\Projects\Classical-Piano-Composer-master\lstm.py", line 37, in get_notes
parts = instrument.partitionByInstrument(midi)
File "E:\Python\3.6.2\lib\site-packages\music21\instrument.py", line 1842, in partitionByInstrument
p.insert(subStream.elementOffset(e), e)
File "E:\Python\3.6.2\lib\site-packages\music21\stream_init
.py", line 1701, in insert
self.coreGuardBeforeAddElement(element)
File "E:\Python\3.6.2\lib\site-packages\music21\stream\core.py", line 313, in coreGuardBeforeAddElement
(element, id(element), self, id(self)))
File "E:\Python\3.6.2\lib\site-packages\music21\stream_init
.py", line 245, in repr
return super().repr(self)
TypeError: expected 0 arguments, got 1

If anyone could help, I would very much appreciate it,
Thanks

Can't Run with Tensorflow-gpu

I have a RTX 2070 and so I want to make sure it runs on my GPU since it will be significantly faster than cpu. But, after installing tensorflow-gpu, CUDA, and all other dependencies listed on the tensorflow website, it throws back this:

Traceback (most recent call last):
  File "C:\Users\chhou\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\LocalCache\local-packages\Python37\site-packages\tensorflow\python\client\session.py", line 1356, in _do_call
    return fn(*args)
  File "C:\Users\chhou\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\LocalCache\local-packages\Python37\site-packages\tensorflow\python\client\session.py", line 1339, in _run_fn
    self._extend_graph()
  File "C:\Users\chhou\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\LocalCache\local-packages\Python37\site-packages\tensorflow\python\client\session.py", line 1374, in _extend_graph
    tf_session.ExtendSession(self._session)
tensorflow.python.framework.errors_impl.InvalidArgumentError: No OpKernel was registered to support Op 'CudnnRNN' used by {{node cu_dnnlstm_1/CudnnRNN}}with these attrs: [seed=87654321, dropout=0, T=DT_FLOAT, input_mode="linear_input", direction="unidirectional", rnn_mode="lstm", is_training=true, seed2=0]
Registered devices: [CPU]
Registered kernels:
  <no registered kernels>

	 [[cu_dnnlstm_1/CudnnRNN]]

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "D:\Users\chhou\Desktop\Classical-Piano-Composer-master\lstm.py", line 125, in <module>
    train_network()
  File "D:\Users\chhou\Desktop\Classical-Piano-Composer-master\lstm.py", line 27, in train_network
    train(model, network_input, network_output)
  File "D:\Users\chhou\Desktop\Classical-Piano-Composer-master\lstm.py", line 122, in train
    model.fit(network_input, network_output, epochs=200, batch_size=128, callbacks=callbacks_list)
  File "C:\Users\chhou\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\LocalCache\local-packages\Python37\site-packages\keras\engine\training.py", line 1213, in fit
    self._make_train_function()
  File "C:\Users\chhou\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\LocalCache\local-packages\Python37\site-packages\keras\engine\training.py", line 333, in _make_train_function
    **self._function_kwargs)
  File "C:\Users\chhou\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\LocalCache\local-packages\Python37\site-packages\keras\backend\tensorflow_backend.py", line 3006, in function
    v1_variable_initialization()
  File "C:\Users\chhou\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\LocalCache\local-packages\Python37\site-packages\keras\backend\tensorflow_backend.py", line 420, in v1_variable_initialization
    session = get_session()
  File "C:\Users\chhou\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\LocalCache\local-packages\Python37\site-packages\keras\backend\tensorflow_backend.py", line 385, in get_session
    return tf_keras_backend.get_session()
  File "C:\Users\chhou\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\LocalCache\local-packages\Python37\site-packages\tensorflow\python\keras\backend.py", line 462, in get_session
    _initialize_variables(session)
  File "C:\Users\chhou\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\LocalCache\local-packages\Python37\site-packages\tensorflow\python\keras\backend.py", line 879, in _initialize_variables
    [variables_module.is_variable_initialized(v) for v in candidate_vars])
  File "C:\Users\chhou\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\LocalCache\local-packages\Python37\site-packages\tensorflow\python\client\session.py", line 950, in run
    run_metadata_ptr)
  File "C:\Users\chhou\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\LocalCache\local-packages\Python37\site-packages\tensorflow\python\client\session.py", line 1173, in _run
    feed_dict_tensor, options, run_metadata)
  File "C:\Users\chhou\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\LocalCache\local-packages\Python37\site-packages\tensorflow\python\client\session.py", line 1350, in _do_run
    run_metadata)
  File "C:\Users\chhou\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\LocalCache\local-packages\Python37\site-packages\tensorflow\python\client\session.py", line 1370, in _do_call
    raise type(e)(node_def, op, message)
tensorflow.python.framework.errors_impl.InvalidArgumentError: No OpKernel was registered to support Op 'CudnnRNN' used by node cu_dnnlstm_1/CudnnRNN (defined at C:\Users\chhou\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\LocalCache\local-packages\Python37\site-packages\keras\layers\cudnn_recurrent.py:517) with these attrs: [seed=87654321, dropout=0, T=DT_FLOAT, input_mode="linear_input", direction="unidirectional", rnn_mode="lstm", is_training=true, seed2=0]
Registered devices: [CPU]
Registered kernels:
  <no registered kernels>

	 [[cu_dnnlstm_1/CudnnRNN]]

Errors may have originated from an input operation.
Input Source operations connected to node cu_dnnlstm_1/CudnnRNN:
 cu_dnnlstm_1/transpose (defined at C:\Users\chhou\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\LocalCache\local-packages\Python37\site-packages\keras\layers\cudnn_recurrent.py:484)	
 cu_dnnlstm_1/ExpandDims_1 (defined at C:\Users\chhou\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\LocalCache\local-packages\Python37\site-packages\keras\layers\cudnn_recurrent.py:487)	
 cu_dnnlstm_1/ExpandDims_2 (defined at C:\Users\chhou\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\LocalCache\local-packages\Python37\site-packages\keras\layers\cudnn_recurrent.py:488)	
 cu_dnnlstm_1/concat_1 (defined at C:\Users\chhou\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\LocalCache\local-packages\Python37\site-packages\keras\layers\cudnn_recurrent.py:60)

I don't really know what to make of this as it seems to be coming from files within the various packages required by the composer.

NOTE: This is with tensorflow-gpu 1.14 as most forums said to downgrade to that if you recieve the ModuleNotFoundError: No module named 'tensorflow.contrib error, which i was getting with the latest version.

RuntimeError: Unable to create attribute (Object header message is too large)

Running the files unmodified in Python 3.6.4 on windows I get the following trace:

Traceback (most recent call last):
  File "lstm.py", line 122, in <module>
    train_network()
  File "lstm.py", line 26, in train_network
    train(model, network_input, network_output)
  File "lstm.py", line 119, in train
    model.fit(network_input, network_output, epochs=200, batch_size=64, callbacks=callbacks_list, include_optimizer=False)
  File "D:\Programs\Python\Python36\lib\site-packages\keras\engine\training.py", line 1035, in fit
    validation_steps=validation_steps)
  File "D:\Programs\Python\Python36\lib\site-packages\keras\engine\training_arrays.py", line 217, in fit_loop
    callbacks.on_epoch_end(epoch, epoch_logs)
  File "D:\Programs\Python\Python36\lib\site-packages\keras\callbacks.py", line 79, in on_epoch_end
    callback.on_epoch_end(epoch, logs)
  File "D:\Programs\Python\Python36\lib\site-packages\keras\callbacks.py", line 446, in on_epoch_end
    self.model.save(filepath, overwrite=True)
  File "D:\Programs\Python\Python36\lib\site-packages\keras\engine\network.py", line 1081, in save
    save_model(self, filepath, overwrite, include_optimizer)
  File "D:\Programs\Python\Python36\lib\site-packages\keras\engine\saving.py", line 381, in save_model
    _serialize_model(model, f, include_optimizer)
  File "D:\Programs\Python\Python36\lib\site-packages\keras\engine\saving.py", line 113, in _serialize_model
    layer_group[name] = val
  File "D:\Programs\Python\Python36\lib\site-packages\keras\utils\io_utils.py", line 256, in __setitem__
    self.data.attrs[attr] = val
  File "h5py\_objects.pyx", line 54, in h5py._objects.with_phil.wrapper
  File "h5py\_objects.pyx", line 55, in h5py._objects.with_phil.wrapper
  File "D:\Programs\Python\Python36\lib\site-packages\h5py\_hl\attrs.py", line 95, in __setitem__
    self.create(name, data=value, dtype=base.guess_dtype(value))
  File "D:\Programs\Python\Python36\lib\site-packages\h5py\_hl\attrs.py", line 188, in create
    attr = h5a.create(self._id, self._e(tempname), htype, space)
  File "h5py\_objects.pyx", line 54, in h5py._objects.with_phil.wrapper
  File "h5py\_objects.pyx", line 55, in h5py._objects.with_phil.wrapper
  File "h5py\h5a.pyx", line 47, in h5py.h5a.create
RuntimeError: Unable to create attribute (object header message is too large)

running pip3 show for the libraries:

Name: music21
Version: 5.3.0
---
Name: Keras
Version: 2.2.2
---
Name: tensorflow-gpu
Version: 1.10.0
---
Name: h5py
Version: 2.8.0

Can you tell me what versions you are using? Seems to be a known problem with Keras per: keras-team/keras#6766 but I assume there's a version that works. Thanks!

Training is very slow

Hi Skuldur,

I am using your training script to train with my own midi files. I don't know why, but the training is going very slowly. It takes about 25 minutes to train only one epoch. I'm confused because i have a brand new GTX 1070 with drivers installed including geforce experience, cuda 9.0 (because tensorflow is incompatible with version 9.2 for some reason), and cudNN. With another training script (it's for generating text) it took only 1-2 minutes per epoch, but its model only had 1 LSTM so that might also be relatively slow.
How long did it take you to train with your midi files, with what GPU?
If you can help, it would be greatly appreciated.

Thanks,
Kevaday

randomSeed

hi,

I prefer to work with google Colaboratory online ...So, can I use your code to do a Jupyter notebook there ... Should i quote you or you prefer not.

Also, I want to render the same training with different epochs, like the 10th , 20th , 40th , ... but with the same randomSeed.

On the predict.py
I put numpy.random.seed(2) overthere
def generate_notes(model, network_input, pitchnames, n_vocab):

and I probably need another randomSeed for tensorflow.
Can I put it right after the import like:

import tensorflow as tf
tf.random.set_seed(1)

Best.

unable to load weights from weights.hdf5

ValueError: Dimension 1 in both shapes must be equal, but are 1024 and 2048. Shapes are [1,1024] and [1,2048]. for 'Assign' (op: 'Assign') with input shapes: [1,1024], [1,2048]. is the error being shown

A few issues (with solutions)

I spent several hours tinkering with this to make it work, so I figured I would share my solutions. I knew very little about NNs before I did all this, so maybe it will help someone in a similar position.

First, you may get an error when you run predict.py. It says something along the lines of data not matching. Open predict.py in your editor and navigate to line 70, where you will find this:

model.load_weights('weights.hdf5')

Change it to this:

model.load_weights('new_weights.hdf5')

If you train the model, it will kick out a new file name like "weights-improvement-01-0.4282-bigger.hdf5". You have to change the file name used by model.load_weights each time you train the model to match the new hdf5 file generated. So after you train it, and you want to use the new model you just trained, you will need to edit line 70 to look something like this:

model.load_weights('weights-improvement-01-0.4282-bigger.hdf5')

Weirdly, after you train the model, it doesn't seem to work any longer with new_weights.hdf5. Of course, if you want to go back to the default, just re-download the directory and start from scratch.

If you try to train the model without making any changes, it will take forever. I found two solutions to this. First, adjust the data. If you go to the midi_songs folder you will find a ton of files. Get rid of most of them--leave only 10-15 that you really like. Then, open lstm.py in your editor and navigate to line 119, where you will find this:

model.fit(network_input, network_output, epochs=200, batch_size=64, callbacks=callbacks_list)

Change batch_size to 32. If you don't do this, the loss function will stall out and you won't get anywhere:

model.fit(network_input, network_output, epochs=200, batch_size=32, callbacks=callbacks_list)

You can also go to lines 95, 97, and 100, where you will find the following line of code repeated:

model.add(Dropout(0.3))

I reduced this from 0.3 to 0.2 on all 3 lines. I have no idea what I'm doing, so I don't know if it actually made any meaningful difference.

The big time saver was configuring tensorflow to work with my computer's GPU. This was a pain in the ass, but worth it. As of the time I'm writing this, the following does NOT work on Python 3.7, so use 3.6.

Open your command prompt as administrator and execute this:

pip uninstall tensorflow

If you hadn't installed it yet, then it will obviously tell you that. Then execute this:

pip install tensorflow-gpu

This gave me version 1.13. Then, you need to go to nVidia's website and download a couple things (you can just search them on Google). You'll have to sign up for an account and membership, but it's free and doesn't take that long. The first thing you need to install is CUDA 9.0. If you want to also spend 6 hours troubleshooting, get a different version. If you want it to just work, get version 9.0.

It will install to a directory in program files called 'nVidia GPU Computing Toolkit.' You have to include this new directory in your PATH environment variable. This is easy. If you don't know how to do it, there are a ton of guides... it takes like 10 seconds.

Once you've done that, open the nVidia GPU Computing Toolkit folder and leave it open. Then you need to get cuDNN v7.0.5. When you finally get to the page, you won't immediately see the download. Ctrl+F for the word "archive" to find the link which expands the page and will let you navigate to the download for this.

Once cuDNN is done downloading, you have to copy the contents within the cuDNN folder into the corresponding folders in your nVidia GPU Computing Toolkit folder. You can't just add the cuDNN folder to your environment variable. The file in cuDNN's "bin" folder needs to go into the nVidia GPU Computing Toolkit "bin" folder. The file in cuDNN's "include" folder needs to go into the nVidia GPU Computing Toolkit's "include" folder, and so on for the last of the three folders in the cuDNN folder. Example: https://masoncusack.github.io/blog/assets/img/postimgs/tfgpu-getting-started/bintobin.gif

I'm using a GTX860 in my laptop and went from about 1h5m per epoch to about 15 minutes per epoch (this was before I adjusted the data). Once I trimmed down the number of midi files, each epoch took about 30 seconds.

Note that there is a delicate balance between versions. Tensorflow 1.13, CUDA 9.0, cuDNN 7.0.5. If you step a single toe out of line, the errors will haunt your dreams for eternity. If for whatever reason you get a different version of Tensorflow, you can navigate to build-info.py (or something very similar to that), open it, and see what versions of these it's expecting you to use. Your debugger should give you the file path for it. Otherwise, you'll have to navigate to your python directory, then to your tensorflow directory, to find it.

As far as the results it generates, I'm impressed. I have always had a pretty good ear, and can hear harmonies and chord progressions that aren't actually there. This program comes up with stuff I never would have thought of. I'm pretty excited to compose an accompaniment for some of the melodies it generated.

Using weights trained on anohter computer

So I have trained the model on a seperate computer, since it made the training faster. When using predict.py it works fine and generates the songs as expected. However, when i try and use the weights on my laptop(a different computer) the following error appears.

ValueError: Shapes (256, 901) and (256, 553) are incompatible

Anybody knows how to fix this?

[predict.py] Impossible to create network

I'm using Python3 on Windows 10 and after training my network, I try to run predict.py and I have this error message :

Classical-Piano-Composer> python predict.py
Using TensorFlow backend.
Traceback (most recent call last):
  File "C:\Python36\lib\site-packages\tensorflow\python\framework\ops.py", line 1576, in _create_c_op
    c_op = c_api.TF_FinishOperation(op_desc)
tensorflow.python.framework.errors_impl.InvalidArgumentError: Dimension 1 in both shapes must be equal, but are 358 and 359. Shapes are [256,358] and [256,359]. for 'Assign_11' (op: 'Assign') with input shapes: [256,358], [256,359].

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "predict.py", line 134, in <module>
    generate()
  File "predict.py", line 24, in generate
    model = create_network(normalized_input, n_vocab)
  File "predict.py", line 70, in create_network
    model.load_weights('weights.hdf5')
  File "C:\Python36\lib\site-packages\keras\engine\network.py", line 1161, in load_weights
    f, self.layers, reshape=reshape)
  File "C:\Python36\lib\site-packages\keras\engine\saving.py", line 928, in load_weights_from_hdf5_group
    K.batch_set_value(weight_value_tuples)
  File "C:\Python36\lib\site-packages\keras\backend\tensorflow_backend.py", line 2435, in batch_set_value
    assign_op = x.assign(assign_placeholder)
  File "C:\Python36\lib\site-packages\tensorflow\python\ops\variables.py", line 645, in assign
    return state_ops.assign(self._variable, value, use_locking=use_locking)
  File "C:\Python36\lib\site-packages\tensorflow\python\ops\state_ops.py", line 216, in assign
    validate_shape=validate_shape)
  File "C:\Python36\lib\site-packages\tensorflow\python\ops\gen_state_ops.py", line 63, in assign
    use_locking=use_locking, name=name)
  File "C:\Python36\lib\site-packages\tensorflow\python\framework\op_def_library.py", line 787, in _apply_op_helper
    op_def=op_def)
  File "C:\Python36\lib\site-packages\tensorflow\python\util\deprecation.py", line 454, in new_func
    return func(*args, **kwargs)
  File "C:\Python36\lib\site-packages\tensorflow\python\framework\ops.py", line 3155, in create_op
    op_def=op_def)
  File "C:\Python36\lib\site-packages\tensorflow\python\framework\ops.py", line 1731, in __init__
    control_input_ops)
  File "C:\Python36\lib\site-packages\tensorflow\python\framework\ops.py", line 1579, in _create_c_op
    raise ValueError(str(e))
ValueError: Dimension 1 in both shapes must be equal, but are 358 and 359. Shapes are [256,358] and [256,359]. for 'Assign_11' (op: 'Assign') with input shapes: [256,358], [256,359].

Shape Error

Hello,

I ran the training file with no issues, but when I ran the predict file I received the error below. Can you help me understand how to fix this?

runfile('C:/Users/ccalvert/PycharmProjects/NeuralMusic/venv/predict.py', wdir='C:/Users/ccalvert/PycharmProjects/NeuralMusic/venv')
Using TensorFlow backend.
Traceback (most recent call last):
File "C:\Users\ccalvert\PycharmProjects\NeuralMusic\venv\lib\site-packages\tensorflow\python\framework\ops.py", line 1628, in _create_c_op
c_op = c_api.TF_FinishOperation(op_desc)
tensorflow.python.framework.errors_impl.InvalidArgumentError: Dimension 1 in both shapes must be equal, but are 144 and 359. Shapes are [256,144] and [256,359]. for 'Assign_11' (op: 'Assign') with input shapes: [256,144], [256,359].
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "", line 1, in
File "C:\Program Files\JetBrains\PyCharm 2018.2.4\helpers\pydev_pydev_bundle\pydev_umd.py", line 197, in runfile
pydev_imports.execfile(filename, global_vars, local_vars) # execute the script
File "C:\Program Files\JetBrains\PyCharm 2018.2.4\helpers\pydev_pydev_imps_pydev_execfile.py", line 18, in execfile
exec(compile(contents+"\n", file, 'exec'), glob, loc)
File "C:/Users/ccalvert/PycharmProjects/NeuralMusic/venv/predict.py", line 135, in
generate()
File "C:/Users/ccalvert/PycharmProjects/NeuralMusic/venv/predict.py", line 25, in generate
model = create_network(normalized_input, n_vocab)
File "C:/Users/ccalvert/PycharmProjects/NeuralMusic/venv/predict.py", line 71, in create_network
model.load_weights('weights.hdf5')
File "C:\Users\ccalvert\PycharmProjects\NeuralMusic\venv\lib\site-packages\keras\engine\network.py", line 1166, in load_weights
f, self.layers, reshape=reshape)
File "C:\Users\ccalvert\PycharmProjects\NeuralMusic\venv\lib\site-packages\keras\engine\saving.py", line 1058, in load_weights_from_hdf5_group
K.batch_set_value(weight_value_tuples)
File "C:\Users\ccalvert\PycharmProjects\NeuralMusic\venv\lib\site-packages\keras\backend\tensorflow_backend.py", line 2465, in batch_set_value
assign_op = x.assign(assign_placeholder)
File "C:\Users\ccalvert\PycharmProjects\NeuralMusic\venv\lib\site-packages\tensorflow\python\ops\variables.py", line 1718, in assign
name=name)
File "C:\Users\ccalvert\PycharmProjects\NeuralMusic\venv\lib\site-packages\tensorflow\python\ops\state_ops.py", line 221, in assign
validate_shape=validate_shape)
File "C:\Users\ccalvert\PycharmProjects\NeuralMusic\venv\lib\site-packages\tensorflow\python\ops\gen_state_ops.py", line 64, in assign
use_locking=use_locking, name=name)
File "C:\Users\ccalvert\PycharmProjects\NeuralMusic\venv\lib\site-packages\tensorflow\python\framework\op_def_library.py", line 787, in _apply_op_helper
op_def=op_def)
File "C:\Users\ccalvert\PycharmProjects\NeuralMusic\venv\lib\site-packages\tensorflow\python\util\deprecation.py", line 488, in new_func
return func(*args, **kwargs)
File "C:\Users\ccalvert\PycharmProjects\NeuralMusic\venv\lib\site-packages\tensorflow\python\framework\ops.py", line 3274, in create_op
op_def=op_def)
File "C:\Users\ccalvert\PycharmProjects\NeuralMusic\venv\lib\site-packages\tensorflow\python\framework\ops.py", line 1792, in init
control_input_ops)
File "C:\Users\ccalvert\PycharmProjects\NeuralMusic\venv\lib\site-packages\tensorflow\python\framework\ops.py", line 1631, in _create_c_op
raise ValueError(str(e))
ValueError: Dimension 1 in both shapes must be equal, but are 144 and 359. Shapes are [256,144] and [256,359]. for 'Assign_11' (op: 'Assign') with input shapes: [256,144], [256,359].

KeyError

Hello,
When I'm executing predict.py using Keras' Theano backend, I always get an error like this:

Traceback (most recent call last):
  File "predict.py", line 134, in <module>
    generate()
  File "predict.py", line 25, in generate
    prediction_output = generate_notes(model, network_input, pitchnames, n_vocab)
  File "predict.py", line 92, in generate_notes
    result = int_to_note[index]
KeyError: 68 [or something similar, a.e. 143 or something else]

I switched to the theano backend, because TensorFlow gave me an error while installing.

I hope you can help me.

MagicMarvMan

loss becomes nan

When I switched cpu based Keras to PaidML based Keras, loss values became "nan" while running Istm.py. It was not the case before. Would you guess what the reason is ?

MIDI generated is just one note repeated

Hello,

First of all, thank you for putting this repo together! I am running into an issue where my generated MIDI is just one note repeated. I made two change to the model. I changed LSTM to CuDNNLSTM and added dropout layers in between because CuDNNLSTM has no inbuilt dropout layers. Does anyone know why this is happening? My model is

  model = Sequential()
  model.add(CuDNNLSTM(
       512,
       input_shape=(network_input.shape[1], network_input.shape[2]),
       return_sequences=True
   ))
   model.add(Dropout(0.2))
   model.add(CuDNNLSTM(512, return_sequences=True,))
   model.add(Dropout(0.2))
   model.add(CuDNNLSTM(512))
   model.add(Dropout(0.2))
   model.add(BatchNorm())
   model.add(Dropout(0.3))
   model.add(Dense(256))
   model.add(Activation('relu'))
   model.add(BatchNorm())
   model.add(Dropout(0.3))
   model.add(Dense(n_vocab))
   model.add(Activation('softmax'))
   model.compile(loss='categorical_crossentropy', optimizer='rmsprop')
   return model 

Screen Shot 2022-05-03 at 11 52 45 AM

Continue training?

I am using linux and my everytime i run the code it starts the training all over from the beginning. How do i continue training?

Alternate Instruments

Can music be generated for other instruments? I've tried using GM 1 sound set to replace the values in your program. ie Replace the value 0 which basically means Piano with a value 4 ie, Electric Piano but that doesn't seem to work.
notes_to_parse = s2.parts[4].recurse()
and the line
new_note.storedInstrument = instrument.instrumentFromMidiProgram(4)
But for some reason it always gives the default Piano. Any options, suggestions please do let me know

ValueError(Shape error) while running predict.py iam getting this error. Anyone can help me,Thanks in advance

C:\Users\nagan\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\framework\dtypes.py:469: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_qint8 = np.dtype([("qint8", np.int8, 1)])
C:\Users\nagan\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\framework\dtypes.py:470: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_quint8 = np.dtype([("quint8", np.uint8, 1)])
C:\Users\nagan\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\framework\dtypes.py:471: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_qint16 = np.dtype([("qint16", np.int16, 1)])
C:\Users\nagan\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\framework\dtypes.py:472: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_quint16 = np.dtype([("quint16", np.uint16, 1)])
C:\Users\nagan\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\framework\dtypes.py:473: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
np_qint32 = np.dtype([("qint32", np.int32, 1)])
C:\Users\nagan\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\framework\dtypes.py:476: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
np_resource = np.dtype([("resource", np.ubyte, 1)])
C:\Users\nagan\AppData\Local\Programs\Python\Python36\lib\site-packages\h5py_init
.py:36: FutureWarning: Conversion of the second argument of issubdtype from float to np.floating is deprecated. In future, it will be treated as np.float64 == np.dtype(float).type.
from ._conv import register_converters as _register_converters
Using TensorFlow backend.
Traceback (most recent call last):
File "C:\Users\nagan\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\framework\common_shapes.py", line 686, in _call_cpp_shape_fn_impl
input_tensors_as_shapes, status)
File "C:\Users\nagan\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\framework\errors_impl.py", line 473, in exit
c_api.TF_GetCode(self.status.status))
tensorflow.python.framework.errors_impl.InvalidArgumentError: Dimension 1 in both shapes must be equal, but are 358 and 279 for 'Assign_19' (op: 'Assign') with input shapes: [256,358], [256,279].

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "predict.py", line 148, in
generate()
File "predict.py", line 30, in generate
model = create_network(normalized_input, n_vocab)
File "predict.py", line 84, in create_network
model.load_weights('weights.hdf5')
File "C:\Users\nagan\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\keras_impl\keras\models.py", line 693, in load_weights
topology.load_weights_from_hdf5_group(f, layers)
File "C:\Users\nagan\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\keras_impl\keras\engine\topology.py", line 1486, in load_weights_from_hdf5_group
K.batch_set_value(weight_value_tuples)
File "C:\Users\nagan\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\keras_impl\keras\backend.py", line 2401, in batch_set_value
assign_op = x.assign(assign_placeholder)
File "C:\Users\nagan\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\ops\variables.py", line 573, in assign
return state_ops.assign(self._variable, value, use_locking=use_locking)
File "C:\Users\nagan\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\ops\state_ops.py", line 276, in assign
validate_shape=validate_shape)
File "C:\Users\nagan\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\ops\gen_state_ops.py", line 56, in assign
use_locking=use_locking, name=name)
File "C:\Users\nagan\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\framework\op_def_library.py", line 787, in _apply_op_helper
op_def=op_def)
File "C:\Users\nagan\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\framework\ops.py", line 2958, in create_op
set_shapes_for_outputs(ret)
File "C:\Users\nagan\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\framework\ops.py", line 2209, in set_shapes_for_outputs
shapes = shape_func(op)
File "C:\Users\nagan\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\framework\ops.py", line 2159, in call_with_requiring
return call_cpp_shape_fn(op, require_shape_fn=True)
File "C:\Users\nagan\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\framework\common_shapes.py", line 627, in call_cpp_shape_fn
require_shape_fn)
File "C:\Users\nagan\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\framework\common_shapes.py", line 691, in _call_cpp_shape_fn_impl
raise ValueError(err.message)
ValueError: Dimension 1 in both shapes must be equal, but are 358 and 279 for 'Assign_19' (op: 'Assign') with input shapes: [256,358], [256,279].

Missing license information

Can you please confirm the associated license for this project? I am asking because I would like to contribute to the project, considering it is open-source.

Only one track, playing

A normal piano midi has 2 tracks. One left and one right. When I trained it on some bach piano pieces, the loss went to around 0.1 and I ran the predict.py with the weights loaded. The results did sound like bach, but its only a mono track that's playing. I fed the network with 2 tracks for the piano. Is there something I didn't do?

How to generate my own notes.dms file

Hi, your article on how to generate music is awesome!

I was training my own version of model (which should contain the same logic) with some different training midi files, and the prediction generation actually throws an error, as there are only 112 total different notes in that training set and the notes.dms file has 352 different notes, meaning the LSTM doesn't work, as "Dimension 1 in both shapes must be equal, but are 352 and 112. Shapes are [256,352] and [256,112]." (The notes.dms is 352 notes, and I'm assuming the 112 comes from my own training data likely being only 112 notes wide, as I only put in a couple of songs.)

Is there some way to create my own notes.dms file to accurately reflect the training set of midi files and get around this error?

Thank you very much!

Stuck on I tensorflow/compiler/xla/service/service.cc:176] StreamExecutor device (0): Host, Default Version

I run the code on a VPS, with no GPU, 1 core:

root@sen:~/Classical-Piano-Composer# python3 predict.py
2020-09-12 21:38:55.011241: W tensorflow/stream_executor/platform/default/dso_loader.cc:59] Could not load dynamic library 'libcudart.so.10.1'; dlerror: libcudart.so.10.1: cannot open shared object file: No such file or directory
2020-09-12 21:38:55.011490: I tensorflow/stream_executor/cuda/cudart_stub.cc:29] Ignore above cudart dlerror if you do not have a GPU set up on your machine.
2020-09-12 21:38:56.976093: W tensorflow/stream_executor/platform/default/dso_loader.cc:59] Could not load dynamic library 'libcuda.so.1'; dlerror: libcuda.so.1: cannot open shared object file: No such file or directory
2020-09-12 21:38:56.976328: W tensorflow/stream_executor/cuda/cuda_driver.cc:312] failed call to cuInit: UNKNOWN ERROR (303)
2020-09-12 21:38:56.976412: I tensorflow/stream_executor/cuda/cuda_diagnostics.cc:156] kernel driver does not appear to be running on this host (sen): /proc/driver/nvidia/version does not exist
2020-09-12 21:38:56.976853: I tensorflow/core/platform/cpu_feature_guard.cc:142] This TensorFlow binary is optimized with oneAPI Deep Neural Network Library (oneDNN)to use the following CPU instructions in performance-critical operations:  AVX2 FMA
To enable them in other operations, rebuild TensorFlow with the appropriate compiler flags.
2020-09-12 21:38:56.984196: I tensorflow/core/platform/profile_utils/cpu_utils.cc:104] CPU Frequency: 2499995000 Hz
2020-09-12 21:38:56.984414: I tensorflow/compiler/xla/service/service.cc:168] XLA service 0x63939a0 initialized for platform Host (this does not guarantee that XLA will be used). Devices:
2020-09-12 21:38:56.984470: I tensorflow/compiler/xla/service/service.cc:176]   StreamExecutor device (0): Host, Default Version

It is stuck on I tensorflow/compiler/xla/service/service.cc:176] StreamExecutor device (0): Host, Default Version

data file

what does the notes in data file contains ?
how can I open it ?

Training is not working

When using the hardcoded weights, the predict script works fine and produces a multi-notes midi file. However, when training from scratch, using lstm script for learning the weigths, the predict script produces a single note midi file. I tried several combinations of subsets (from midi songs folder), and the result is always the same.

Question about Parts used from the midi files

Hello @Skuldur,

Very cool project. I want to use this as a starting point to hopefully try a few more things out. One question regarding the code is lstm.py:
In line 42: notes_to_parse = s2.parts[0].recurse()

You are using only the first part and not the others ? Am I missing something or why do you ignore the other parts ?

Thanks in advance

ValueError(Shape error)

C:\Users\nagan\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\framework\dtypes.py:469: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_qint8 = np.dtype([("qint8", np.int8, 1)])
C:\Users\nagan\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\framework\dtypes.py:470: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_quint8 = np.dtype([("quint8", np.uint8, 1)])
C:\Users\nagan\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\framework\dtypes.py:471: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_qint16 = np.dtype([("qint16", np.int16, 1)])
C:\Users\nagan\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\framework\dtypes.py:472: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_quint16 = np.dtype([("quint16", np.uint16, 1)])
C:\Users\nagan\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\framework\dtypes.py:473: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
np_qint32 = np.dtype([("qint32", np.int32, 1)])
C:\Users\nagan\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\framework\dtypes.py:476: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
np_resource = np.dtype([("resource", np.ubyte, 1)])
C:\Users\nagan\AppData\Local\Programs\Python\Python36\lib\site-packages\h5py_init
.py:36: FutureWarning: Conversion of the second argument of issubdtype from float to np.floating is deprecated. In future, it will be treated as np.float64 == np.dtype(float).type.
from ._conv import register_converters as _register_converters
Using TensorFlow backend.
Traceback (most recent call last):
File "C:\Users\nagan\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\framework\common_shapes.py", line 686, in _call_cpp_shape_fn_impl
input_tensors_as_shapes, status)
File "C:\Users\nagan\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\framework\errors_impl.py", line 473, in exit
c_api.TF_GetCode(self.status.status))
tensorflow.python.framework.errors_impl.InvalidArgumentError: Dimension 1 in both shapes must be equal, but are 358 and 279 for 'Assign_19' (op: 'Assign') with input shapes: [256,358], [256,279].

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "predict.py", line 148, in
generate()
File "predict.py", line 30, in generate
model = create_network(normalized_input, n_vocab)
File "predict.py", line 84, in create_network
model.load_weights('weights.hdf5')
File "C:\Users\nagan\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\keras_impl\keras\models.py", line 693, in load_weights
topology.load_weights_from_hdf5_group(f, layers)
File "C:\Users\nagan\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\keras_impl\keras\engine\topology.py", line 1486, in load_weights_from_hdf5_group
K.batch_set_value(weight_value_tuples)
File "C:\Users\nagan\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\keras_impl\keras\backend.py", line 2401, in batch_set_value
assign_op = x.assign(assign_placeholder)
File "C:\Users\nagan\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\ops\variables.py", line 573, in assign
return state_ops.assign(self._variable, value, use_locking=use_locking)
File "C:\Users\nagan\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\ops\state_ops.py", line 276, in assign
validate_shape=validate_shape)
File "C:\Users\nagan\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\ops\gen_state_ops.py", line 56, in assign
use_locking=use_locking, name=name)
File "C:\Users\nagan\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\framework\op_def_library.py", line 787, in _apply_op_helper
op_def=op_def)
File "C:\Users\nagan\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\framework\ops.py", line 2958, in create_op
set_shapes_for_outputs(ret)
File "C:\Users\nagan\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\framework\ops.py", line 2209, in set_shapes_for_outputs
shapes = shape_func(op)
File "C:\Users\nagan\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\framework\ops.py", line 2159, in call_with_requiring
return call_cpp_shape_fn(op, require_shape_fn=True)
File "C:\Users\nagan\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\framework\common_shapes.py", line 627, in call_cpp_shape_fn
require_shape_fn)
File "C:\Users\nagan\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\framework\common_shapes.py", line 691, in _call_cpp_shape_fn_impl
raise ValueError(err.message)
ValueError: Dimension 1 in both shapes must be equal, but are 358 and 279 for 'Assign_19' (op: 'Assign') with input shapes: [256,358], [256,279].

music21.exceptions21.StreamException:

The following comes to me when I try to train, how can I solve this?
My system is macOS , python3.9.1.

music21.exceptions21.StreamException: failed to find TimeSignature in meterStream; cannot process Measures

Traceback (most recent call last):
File "", line 1, in
File "/Applications/PyCharm.app/Contents/plugins/python/helpers/pydev/_pydev_bundle/pydev_umd.py", line 197, in runfile
pydev_imports.execfile(filename, global_vars, local_vars) # execute the script
File "/Applications/PyCharm.app/Contents/plugins/python/helpers/pydev/_pydev_imps/_pydev_execfile.py", line 18, in execfile
exec(compile(contents+"\n", file, 'exec'), glob, loc)
File "/Users/bytedance/Downloads/binds/Classical-Piano-Composer/lstm.py", line 124, in
train_network()
File "/Users/bytedance/Downloads/binds/Classical-Piano-Composer/lstm.py", line 18, in train_network
notes = get_notes()
File "/Users/bytedance/Downloads/binds/Classical-Piano-Composer/lstm.py", line 34, in get_notes
midi = converter.parse(file)
File "/Users/bytedance/Downloads/binds/venv/lib/python3.9/site-packages/music21/converter/init.py", line 1168, in parse
return parseFile(valueStr, number=number, format=m21Format,
File "/Users/bytedance/Downloads/binds/venv/lib/python3.9/site-packages/music21/converter/init.py", line 1037, in parseFile
v.parseFile(fp, number=number, format=format, forceSource=forceSource, **keywords)
File "/Users/bytedance/Downloads/binds/venv/lib/python3.9/site-packages/music21/converter/init.py", line 571, in parseFile
self.parseFileNoPickle(fp, number, format, forceSource, **keywords)
File "/Users/bytedance/Downloads/binds/venv/lib/python3.9/site-packages/music21/converter/init.py", line 504, in parseFileNoPickle
self.subConverter.parseFile(fp, number=number, **keywords)
File "/Users/bytedance/Downloads/binds/venv/lib/python3.9/site-packages/music21/converter/subConverters.py", line 1136, in parseFile
midiTranslate.midiFilePathToStream(fp, self.stream, **keywords)
File "/Users/bytedance/Downloads/binds/venv/lib/python3.9/site-packages/music21/midi/translate.py", line 2602, in midiFilePathToStream
return midiFileToStream(mf, inputM21, **keywords)
File "/Users/bytedance/Downloads/binds/venv/lib/python3.9/site-packages/music21/midi/translate.py", line 2773, in midiFileToStream
midiTracksToStreams(mf.tracks,
File "/Users/bytedance/Downloads/binds/venv/lib/python3.9/site-packages/music21/midi/translate.py", line 2513, in midiTracksToStreams
midiTrackToStream(mt,
File "/Users/bytedance/Downloads/binds/venv/lib/python3.9/site-packages/music21/midi/translate.py", line 1996, in midiTrackToStream
s.makeMeasures(
File "/Users/bytedance/Downloads/binds/venv/lib/python3.9/site-packages/music21/stream/base.py", line 6477, in makeMeasures
return makeNotation.makeMeasures(
File "/Users/bytedance/Downloads/binds/venv/lib/python3.9/site-packages/music21/stream/makeNotation.py", line 544, in makeMeasures
raise stream.StreamException(
music21.exceptions21.StreamException: failed to find TimeSignature in meterStream; cannot process Measures

Midi Output ... One Note Repeating

Hello,
I have run the files and my test_output file is just one note repeating. I ran 20 epochs with 3 files the loss decreased from 4.3 to 3.9. In the predict.py file I manually replaced the weights.hdf5 with the last weight-improvement hdf5 file. Is there something I'm doing wrong?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.