Skip to content
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

gtzan_genre.Track.to_jams #212

Merged
merged 11 commits into from
Apr 8, 2020
Merged

gtzan_genre.Track.to_jams #212

merged 11 commits into from
Apr 8, 2020

Conversation

lostanlen
Copy link
Collaborator

@lostanlen lostanlen commented Apr 6, 2020

This PR implements a JAMS parser for gtzan_genre, in the prospect of closing #197 ("DALI and GTZAN Genre lack a to_jams method")

This was quite easy. I am going to write unit tests now.

PS: nevermind that this branch is called dali-jams. This is a gtzan_genre PR.

EDIT: [rabitt]
This PR now does the following:

  • fixes f0s_to_jams is not compliant with pitch_contour namespace #217
  • adds a test to test_loaders which ensures that the output of every to_jams() method successfully validates
  • the above test broke for nearly every loader, because duration was not part of the file_metadata. I've added duration to every to_jams method.
  • added a new argument to jams_utils.jams_converter for gtzan tags.
  • changes the convention in jams_utils to always us if not isinstance(...) over if type(...) != ...

@codecov
Copy link

codecov bot commented Apr 6, 2020

Codecov Report

Merging #212 into master will increase coverage by 0.07%.
The diff coverage is 98.48%.

@@            Coverage Diff             @@
##           master     #212      +/-   ##
==========================================
+ Coverage   95.90%   95.98%   +0.07%     
==========================================
  Files          19       19              
  Lines        1905     1942      +37     
==========================================
+ Hits         1827     1864      +37     
  Misses         78       78              

@lostanlen lostanlen added this to the 0.2.0 milestone Apr 6, 2020
@lostanlen lostanlen changed the title [WIP] gtzan_genre.Track.to_jams gtzan_genre.Track.to_jams Apr 6, 2020
raise NotImplementedError
"""Jams: the track's data in jams format"""
# Initialize top-level JAMS container
jam = jams.JAMS()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should use the mirdata.jams_utils.jams_converter function. If it's missing fields, we should add them to the converter.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rabitt so i should make a gtzan_to_jams function in jams_utils? and pass a gtzan_data (default None) to the jams_converter? that sounds overkill to me, but i can live with that.

Copy link
Collaborator

@rabitt rabitt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Everything looks good, except that the to_jams method should use the built in jams converter function. Otherwise it looks great.

Rachel Bittner added 2 commits April 7, 2020 16:16
… adds duration to most to_jams() methods; uses jams_converter in gtzan_genre
@rabitt
Copy link
Collaborator

rabitt commented Apr 7, 2020

A caveat - the big change I pushed results in a less complete jams object in the to_jams function. Unfortunately, without substantially changing the converter, this is not trivial and I propose we leave this issue for the future.

'tags_data should be a list of tuples, '
+ 'but contains a {} element'.format(type(tag))
)
jam.annotations.append(tag_gtzan_to_jams(tag))
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tag_gtzan_to_jams returns an Annotation in the gtzan namespace. This Annotation will be JAMS-compliant if and only if the tag is a GTZAN genre: country, jazz, rock, etc.

This tag converter will not work for other datasets than GTZAN (e.g. MSD, which requires tag_open)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes - this is why I called the method "tag_gtzan_to_jams"

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see though - the value is called "tags_data" so it's confusing. I'll update.

@rabitt rabitt merged commit 392f795 into master Apr 8, 2020
nkundiushuti pushed a commit that referenced this pull request Nov 4, 2020
 
gtzan_genre.Track.to_jams (#212)

* fix GTZAN capitalization in docstring

* Implement gtzan_genre.Track.to_jams

* black -S . gtzan_genre

* test JAMS parser for GTZAN

* import jams in gtzan_genre

* import mirdata in gtzan_genre

* define VERSION and ANNOTATION_RULES for gtzan_genre

* fixes #217; adds test that jams validation succeeds for all datasets; adds duration to most to_jams() methods; uses jams_converter in gtzan_genre

* run black

* update tags_data to tags_gtzan_data

authored-by: Rachel Bittner <rmb456@nyu.edu>
@rabitt rabitt deleted the dali-jams branch December 17, 2020 23:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

f0s_to_jams is not compliant with pitch_contour namespace
2 participants