minzwon / RhythmRecognition

7 stars 1 forks source link

Any one could run the project in Python2.7 ? #1

Closed ucasiggcas closed 5 years ago

ucasiggcas commented 5 years ago

Dear All, Who can run the script You will find that No RNNDownBeatProcessor, or No DBNDownBeatTrackingProcessor , If I change the two with RNNBeatProcessor and DBNBeatTrackingProcessor ,it ups bug, 0%| | 0/4180 [00:00<?, ?it/s] Traceback (most recent call last): File "_2_transpose.py", line 88, in <module> fire.Fire({'run': t.run()}) File "_2_transpose.py", line 30, in run b = self.get_beats(songid) File "_2_transpose.py", line 82, in get_beats b.append(item[0]) IndexError: invalid index to scalar variable. What happened? how to solve ?

minzwon commented 5 years ago

Hi,

I think Madmom has changed its hierarchy. https://madmom.readthedocs.io/en/latest/modules/features/downbeats.html

Try to modify the import part. from madmom.features import downbeats as beats Then the code will work.

ucasiggcas commented 5 years ago

Thanks, But I have another bug When I run the fit.py I can't install the machine module How to pip ? I have tried,But Look the picture down, You will find the bug image Any one encounter the question? Thx

minzwon commented 5 years ago

machine is not a pip module. You already have machine.py in the same directory of fit.py.

ucasiggcas commented 5 years ago

Dear, When run fit.py it ups bug as follows image it looks like the bug is from the code self.data = Data() so,how to solve the bug Thx

minzwon commented 5 years ago

In fit.py, it imports data.py. But I think you installed a pip module called data. The error comes from the duplicated name. You have two choices. Remove data from your pip. Or change the name of data.py and import class Data from the new path in fit.py.

ucasiggcas commented 5 years ago

Dear, Thanks I also have a bug in the pic when run fit.py image I don't know how to solve the question

minzwon commented 5 years ago

What was you commend to run the code?

ucasiggcas commented 5 years ago

I have a little change in the fit.py, so I can python fit.py

ucasiggcas commented 5 years ago

What I change is down:

class Learner: def fit_gen(self, tr_filelist='./tr', val_filelist='./val', path='./spec_trp/', meta_path='./metas_9g.cPickle', epochs=20, batch_size=100, validation_split=0.1, weight_checkpoint='./checkpoints/spec_minz.{epoch:02d}.hdf5', out_model_fname='spec_minz.keras', gpu_id = 5,

**fire.Fire({'fit_gen': l.fit_gen()})**
minzwon commented 5 years ago

Your modification is fine I guess. Maybe the problem is your running commend. Library fire helps you to run a definition in your code from outside. By only typing python fit.py will not run anything because it's just a class. Try python fit.py fit_gen

ucasiggcas commented 5 years ago

No matter how I change the script,the same bug is always here.

minzwon commented 5 years ago

From the error message that you shared, I cannot debug your problem. To debug, you have to check the code line by line in fit.py. But it looks like a problem with a legacy generator of Keras. Since this code is from last year, it uses an older version of Keras. You can check followings:

1) Run the code without any modification. Just clone the repository and run it. There is no bug in this code because I checked it with my local, server, and also Docker environments (Mac OSX/Ubuntu). 2) If the same error occurs, try to downgrade your Keras as Keras 2.1.2. It's the version that I used. 3) If the same error message appears, try to figure out where the error occurs in fit.py.

Another option is to use your own implementation. I don't recommend you to waste your time on 3). Check 1) and 2) first, and then if there's still the same error, build a new CNN model with Keras. It won't take that long and there is a lot of implementation already. The main ingredient of this repository is the preprocessing not the model. Without the preprocessing, it's just the same as other CNN implementations.

I don't know for which purpose you want to use this repository, but this preprocessing is beneficial for acquiring robustness against time-stretching or pitch-shifting. If you only care about the accuracy of the classification, this would not give you dramatic improvements.

ucasiggcas commented 5 years ago

Dear, Thanks for your detailed instructions, 1.I git clone the project in a new Ubuntu18.04, and then run . run.sh,but it ups another bug as follows image 2.I have reinstall the keras with pip install keras 3.if I directly . run.sh or sh run.sh,the results are down image image

For the project,I just want to know what is rhythm,could U help me ? Could u display rhythm with mathematical formula? If I have song a music twice,how do I compare the rhythm of the two ? Any advice or suggestion will be great. Thx

minzwon commented 5 years ago

nohup helps you to run a job in your background. Your error message says you don't have a directory called Log. Just create Log in your path by mkdir Log. After you run the code, type tail -f Log/nohup.out then it will show you the progress.

Rhythm cannot be defined as a formula. Previous research in Music Information Retrieval (MIR), they tried to define patterns with manually designed rules. However, recent research expects the machine to learn patterns automatically with data-driven approaches instead of rule-based approaches. This is the core of machine learning and being used in many fields including image processing, natural language processing, and audio signal processing.

If you want to compare two different music excerpts, try to read papers about music similarity. Although it's still very difficult to define our perceptual similarity, there are several research works about it. Check them on Google scholar.