tuwien-musicir / rp_extract

Rhythm Pattern music feature extractor by IFS @ TU-Vienna
GNU General Public License v3.0
111 stars 27 forks source link

use question #20

Closed babyandy0111 closed 7 years ago

babyandy0111 commented 7 years ago

Hi, I'm a python beginner I use this command "D:\python\song_style>python rp_classify.py -t D:/python/song_style/music pop" but always show me "Class label could not be derived from filename! Filename must contain a sub-directory path to be used as class label. Otherwise provide a class label file."

i use windows7 , python 2.7

please help me, what can i do

audiofeature commented 7 years ago

Hi there,

Do you want to train a new model or just categorize a bunch of audio files with a (the) pre-trained model?

1) for categorization with an existing model, use:

default model:

python rp_classify.py input_path

using your own model (see step 2):

python rp_classify.py input_path model_filename

2) if you want to train your own model, you need to provide the genre (or other) categories alongside with each audio file!

there is 2 ways to do it:

a) if your input folder is organized by subgenre, e.g.

D:/python/song_style/music/pop

D:/python/song_style/music/rock D:/python/song_style/music/electro

etc.

you should be able to use:

python rp_classify.py -t D:/python/song_style/music output_model_file

b) otherwise, you’ll need to provide a CSV (actually tab-separated) file, where all the input audio files are listed (relative path) + TAB + a genre label, e.g.:

Blur_Song2.mp3 pop path/to/Metallica_Nothing_Else.mp3 rock ...

Then provide this file via the -c parameter:

python rp_classify.py -t -c class_label_file.csv D:/python/song_style/music output_model_file

Hope that helps, best Thomas

Am 28.03.2017 um 10:41 schrieb babyandy0111 notifications@github.com:

Hi, I'm a python beginner I use this command "D:\python\song_style>python rp_classify.py -t D:/python/song_style/music pop" but always show me "Class label could not be derived from filename! Filename must contain a sub-directory path to be used as class label. Otherwise provide a class label file."

i use windows7 , python 2.7

please help me, what can i do

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/tuwien-musicir/rp_extract/issues/20, or mute the thread https://github.com/notifications/unsubscribe-auth/ALHE6dHAo5I0xNo3faco5882HPShnVY-ks5rqMfEgaJpZM4MrTqc.

-- Thomas Lidy Vienna University of Technology Institute of Software Technology and Interactive Systems Favoritenstraße 9-11/188 A-1040 Vienna, Austria

http://www.ifs.tuwien.ac.at/~lidy

babyandy0111 commented 7 years ago

Hi Thomas thanks for your help. i can't train my model.

1

4

5

i follow step 2, but can't train my model model_filename is dir path or just filename?

thank you very much.

audiofeature commented 7 years ago

If ttt.txt contains your labels, you need to put -c in front of it!

Your model file is a path + filename.

So your command should be:

python rp_classify.py -t -c ttt.txt D:/python/song_style/music D:/python/…/mymodel

Note that you cannot train a model with a single audio file! You should have dozens, hundreds or thousands of songs annotated in order for Machine Learning to make sense of it.

best Thomas

Am 28.03.2017 um 11:43 schrieb babyandy0111 notifications@github.com:

Hi Thomas thanks for your help. i can't train my model.

https://cloud.githubusercontent.com/assets/8206379/24398709/0ebf55c6-13dd-11e7-8cf3-2528e5b67aa4.png https://cloud.githubusercontent.com/assets/8206379/24398966/d067e4ea-13dd-11e7-8a9e-2d8c2d34b509.png https://cloud.githubusercontent.com/assets/8206379/24399055/13107802-13de-11e7-96f7-12087fea4230.png i follow step 2, but can't train my model model_filename is dir path or just filename?

thank you very much.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/tuwien-musicir/rp_extract/issues/20#issuecomment-289718224, or mute the thread https://github.com/notifications/unsubscribe-auth/ALHE6Ty_rp9wM6fB4B8ygMXPOOfeVgHMks5rqNZWgaJpZM4MrTqc.

-- Thomas Lidy Vienna University of Technology Institute of Software Technology and Interactive Systems Favoritenstraße 9-11/188 A-1040 Vienna, Austria

http://www.ifs.tuwien.ac.at/~lidy

babyandy0111 commented 7 years ago

Hi Thomas I try it. it work. but have other error: ValueError: dictionary update sequence element #0 has length 1; 2 is required 6

this is my txt. i use default TAB-separated Class.txt

this is my command python rp_classify.py -t -c D:/python/song_style/Class.txt D:/python/song_style/music D:/python/mymodel

what i lost ? Thanks again.

babyandy0111 commented 7 years ago

Hi i tried edit source code and txt file, but i have another problem

this is error message and my txt file 7 Class.txt

this is my musid dir 8

please, tell me what can i do ? thank you very much

audiofeature commented 7 years ago

Hi,

If you use D:/python/song_style/music as your input_path: python rp_classify.py -t -c D:/python/song_style/Class.txt D:/python/song_style/music D:/python/mymodel

then the file listing in the .txt file should contain paths relative to that, i.e.

Latin\1.wav Latin Latin\2.wav Latin ... Funk\1.wav Funk Funk\2.wav Funk

That is the best way to do it, as it will not allow you to use duplicate „file_ids“ in neither the feature file nor the class.txt file, but with the relative paths (Latin\1.wav and Funk\1.wav) you are fine.

best Thomas

Am 29.03.2017 um 09:44 schrieb babyandy0111 notifications@github.com:

Hi i tried edit source code and txt file, but i have another problem

this is error message and my txt file https://cloud.githubusercontent.com/assets/8206379/24443609/e36d054e-1495-11e7-8499-b1fffd05fdb2.png Class.txt https://github.com/tuwien-musicir/rp_extract/files/878174/Class.txt this is my musid dir https://cloud.githubusercontent.com/assets/8206379/24443664/1481f964-1496-11e7-980b-c7235d2ce76e.png please, tell me what can i do ? thank you very much

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/tuwien-musicir/rp_extract/issues/20#issuecomment-290010057, or mute the thread https://github.com/notifications/unsubscribe-auth/ALHE6RZEkjZSjO5LIrcsvLWC-KuFyFFBks5rqgvNgaJpZM4MrTqc.

-- Thomas Lidy Vienna University of Technology Institute of Software Technology and Interactive Systems Favoritenstraße 9-11/188 A-1040 Vienna, Austria

http://www.ifs.tuwien.ac.at/~lidy

babyandy0111 commented 7 years ago

Hi Thomas thanks for your help :) 9