How to initialize the Track class of guitarset?
Logicino opened this issue · comments
Hello,
I see the Track class in guitarset, however it needs theses parameters:
Track(track_id, data_home, dataset_name, index, metadata)
I think the track_id
represents the number of all the 360 songs, data_home
is the root of the dataset, dataset_name
I suppose is the "guitarset". However, I don't understand what does the "index" and "metadata" mean.
I tried to use "None", but it turns out to be "TypeError: 'NoneType' object is not subscriptable".
I have downloaded all the data of guitarset, like below:
What should I do? Thank you!
the source code of guitarset I see is like this:
`class Track(core.Track):
"""guitarset Track class
Args:
track_id (str): track id of the track
Attributes:
audio_hex_cln_path (str): path to the debleeded hex wave file
audio_hex_path (str): path to the original hex wave file
audio_mic_path (str): path to the mono wave via microphone
audio_mix_path (str): path to the mono wave via downmixing hex pickup
jams_path (str): path to the jams file
mode (str): one of ['solo', 'comp']
For each excerpt, players are asked to first play in 'comp' mode
and later play a 'solo' version on top of the already recorded comp.
player_id (str): ID of the different players.
one of ['00', '01', ... , '05']
style (str): one of ['Jazz', 'Bossa Nova', 'Rock', 'Singer-Songwriter', 'Funk']
tempo (float): BPM of the track
track_id (str): track id
Cached Properties:
beats (BeatData): beat positions
leadsheet_chords (ChordData): chords as written in the leadsheet
inferred_chords (ChordData): chords inferred from played transcription
key_mode (KeyData): key and mode
pitch_contours (dict):
Pitch contours per string
- 'E': F0Data(...)
- 'A': F0Data(...)
- 'D': F0Data(...)
- 'G': F0Data(...)
- 'B': F0Data(...)
- 'e': F0Data(...)
multif0 (MultiF0Data): all pitch contour data as one multif0 annotation
notes (dict):
Notes per string
- 'E': NoteData(...)
- 'A': NoteData(...)
- 'D': NoteData(...)
- 'G': NoteData(...)
- 'B': NoteData(...)
- 'e': NoteData(...)
notes_all (NoteData): all note data as one note annotation
"""
def __init__(
self,
track_id,
data_home,
dataset_name,
index,
metadata,
):`
it seems the Track class of guitarset is inherited from the Track of core
what should the track_id be like?
index (dict): the dataset's file index
`class Track(object):
"""Track base class
See the docs for each dataset loader's Track class for details
"""
def __init__(self, track_id, data_home, dataset_name, index, metadata):
"""Track init method. Sets boilerplate attributes, including:
- ``track_id``
- ``_dataset_name``
- ``_data_home``
- ``_track_paths``
- ``_track_metadata``
Args:
track_id (str): track id
data_home (str): path where mirdata will look for the dataset
dataset_name (str): the identifier of the dataset
index (dict): the dataset's file index
metadata (function or None): a function returning a dictionary of metadata or None
"""
if track_id not in index["tracks"]:
raise ValueError(
"{} is not a valid track_id in {}".format(track_id, dataset_name)
)
`
Hi @Logicino, thanks for using mirdata! The tracks for a dataset are automatically loaded, so you don't need to initialize the tracks like that. Let me write a code example to show how the tracks are loaded in mirdata:
dataset = mirdata.initialize("guitarset", data_home="path/to/data/home")
dataset.download() # If available for open access
dataset.validate() # To make sure all files are there and are not corrupted
dataset_ids = dataset.track_ids # That would load a list of track ids of the dataset
dataset_tracks = dataset.load_tracks() # Now the tracks are loaded, in the form of dict of Tracks
dataset_tracks[dataset_id[0]] # Here you are getting the Track for the first id. Everything should be already loaded
I hope that helps! If that does not resolve your question, please let me know!
Hi @Logicino, thanks for using mirdata! The tracks for a dataset are automatically loaded, so you don't need to initialize the tracks like that. Let me write a code example to show how the tracks are loaded in mirdata:
dataset = mirdata.initialize("guitarset", data_home="path/to/data/home") dataset.download() # If available for open access dataset.validate() # To make sure all files are there and are not corrupted dataset_ids = dataset.track_ids # That would load a list of track ids of the dataset dataset_tracks = dataset.load_tracks() # Now the tracks are loaded, in the form of dict of Tracks dataset_tracks[dataset_id[0]] # Here you are getting the Track for the first id. Everything should be already loaded
I hope that helps! If that does not resolve your question, please let me know!
Dear genisplaja, thank you for your reply!
I suppose the datatrack = Dataset.load_track()
create the new Track class, and methods in "classmirdata.datasets.guitarset.Track(track_id, data_home, dataset_name, index, metadata)" like audio_hex, audio_mic can be retrieved by calling "datatrack[0].audio_mic"
But I still have questions about how to get the pitch_contour.
I tried to get the pitch_contour by
GuitarSet_ids = GuitarSet.track_ids
GuitarSet_tracks = GuitarSet.load_tracks()
pitch_contour_0_E = GuitarSet_tracks[GuitarSet_ids[0]].pitch_contours['E']
print(pitch_contour_0_E)
It has results of
F0Data(confidence, confidence_unit, frequencies, frequency_unit, resample, time_unit, times, to_matrix, to_mir_eval, to_multif0, to_sparse_index, voicing, voicing_unit)
I wander how to see the data in F0Data structure? For example, get the pitch_contour into form of numpy array? Thank you
I tried to take pitch_contour_0_E['confidence']
but it cannot read
BTW, I also see a ``load_pitch_contour` method in
https://mirdata.readthedocs.io/en/stable/source/mirdata.html?highlight=guitarset#mirdata.datasets.guitarset.Track
however it needs two arguments, 'jams_path' and 'leadsheet_version'
what should the 'jams_path' be like? It seems many methods need this?
What's more, I find a problem of using docker dev container in vscode.
the current annotation folder won't be found, however it can be fixed by delete the current annotation folder and redownload it.
I think it might be something wrong with the microsoft docker plugins in vscode because it works in the terminal without using the plugin...
Hi @Logicino, thanks for using mirdata! The tracks for a dataset are automatically loaded, so you don't need to initialize the tracks like that. Let me write a code example to show how the tracks are loaded in mirdata:
dataset = mirdata.initialize("guitarset", data_home="path/to/data/home") dataset.download() # If available for open access dataset.validate() # To make sure all files are there and are not corrupted dataset_ids = dataset.track_ids # That would load a list of track ids of the dataset dataset_tracks = dataset.load_tracks() # Now the tracks are loaded, in the form of dict of Tracks dataset_tracks[dataset_id[0]] # Here you are getting the Track for the first id. Everything should be already loaded
I hope that helps! If that does not resolve your question, please let me know!
Dear genisplaja, thank you for your reply! I suppose the
datatrack = Dataset.load_track()
create the new Track class, and methods in "classmirdata.datasets.guitarset.Track(track_id, data_home, dataset_name, index, metadata)" like audio_hex, audio_mic can be retrieved by calling "datatrack[0].audio_mic" But I still have questions about how to get the pitch_contour. I tried to get the pitch_contour byGuitarSet_ids = GuitarSet.track_ids GuitarSet_tracks = GuitarSet.load_tracks() pitch_contour_0_E = GuitarSet_tracks[GuitarSet_ids[0]].pitch_contours['E'] print(pitch_contour_0_E)
It has results of
F0Data(confidence, confidence_unit, frequencies, frequency_unit, resample, time_unit, times, to_matrix, to_mir_eval, to_multif0, to_sparse_index, voicing, voicing_unit)
I wander how to see the data in F0Data structure? For example, get the pitch_contour into form of numpy array? Thank you I tried to takepitch_contour_0_E['confidence']
but it cannot read
Oh I think I found out this question! It's in the annotations part format
https://mirdata.readthedocs.io/en/stable/source/mirdata.html?highlight=guitarset#annotations
Sorry for disturb! Thank you very much!