-
Notifications
You must be signed in to change notification settings - Fork 58
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added genre to ballroom datataset loader #629
Conversation
@genisplaja @guillemcortes plz review :) |
hey @Masetto96, I did finally take a look at this one and LGTM. Let us update #630 so that codecov works as expected and we can try to merge this one. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right! Almost there, I guess it works as expected, and I don't see any missing tests. Just requesting minor changes for consistency and that's ready :)
Sorry for taking that long to review... we were super busy updating soundata for the JOSS submission man. Thanks for the understanding!
mirdata/datasets/ballroom.py
Outdated
|
||
Cached Properties: | ||
beats (BeatData): human-labeled beat annotations | ||
tempo (float): human-labeled tempo annotations | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove added enter. Or is it because formatting issues?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed the new line, however I noticed that in other scripts it is sometimes present
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok! Was just not to unnecessary change lines. I guess it does not affect at all, I can take a look
mirdata/datasets/ballroom.py
Outdated
@@ -164,6 +168,20 @@ def to_jams(self): | |||
) | |||
|
|||
|
|||
def get_genre(audio_path: Optional[str]) -> Optional[str]: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
normally, for consistency, we name this functions load_<thing>()
. I think it would be nice if you could use this convention here as well
mirdata/datasets/ballroom.py
Outdated
@@ -130,6 +132,8 @@ def __init__( | |||
self.beats_path = self.get_path("beats") | |||
self.tempo_path = self.get_path("tempo") | |||
|
|||
self.genre = get_genre(self.audio_path) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While making the changes I spotted a mistake. Here I changed line 135 to self.load_genre()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes! @Masetto96 although are you sure is self.load_genre()
? I think that the load_genre()
function is outside the class right? Shouldn't it be without the self.
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops, you are right! I assumed it was part of the class but I did not look carefully. Sorry about that!
tests/datasets/test_ballroom.py
Outdated
data_home = "tests/resources/mir_datasets/ballroom" | ||
dataset = ballroom.Dataset(data_home) | ||
track = dataset.track("Media-105901") | ||
genre = ballroom.get_genre(track.audio_path) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Made necessary changes also here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! I guess we need PR #631 to be merged so that the tests pass, and then we can propagate the update to this PR and merge. Thanks @Masetto96 :)
hey @Masetto96, very close but there is a small thing that we are still missing. All custom Then, you would need to see if the filepath exists, and throw, I think, a FileNotFound error otherwise. |
… throwing error if file is not present
Done! Let me know if I there is something else. Thank you for the code review. |
Hey @Masetto96 man, finally fetched your fork and played around to figure out the issue. Sorry that I didn't notice that we were using a too overcomplicated solution for a problem that should be way easier to address. Let me explain how we should be actually loading the genre:
In the end, the genre annotation is not contained in a local file, but rather in a filepath that is already contained in the library itself (in the .json index), so you wouldn't even need to download the dataset to get the genre. Therefore, we don't need a cached property for that. |
…om path name in the init
Of course @genisplaja , your suggestion makes a lot of sense! |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #629 +/- ##
==========================================
+ Coverage 97.07% 97.08% +0.01%
==========================================
Files 64 64
Lines 7392 7388 -4
==========================================
- Hits 7176 7173 -3
+ Misses 216 215 -1 |
#628
The track object of the ballroom dataset does not have the annotation about the genre of the track. Therefore, the genre attribute have been included from the name of the audio path.
Test for getting the genre from the audio path has been implemented.
Following the contribution guidelines, code has been formatted and all tests passed.