Unverified Commit b0367251 authored by Emmanouil Theofanis Chourdakis's avatar Emmanouil Theofanis Chourdakis Committed by GitHub
Browse files

Added the popular GTZAN dataset: (#668)



* Added the popular GTZAN dataset:

* Added the GTZAN class in torchaudio.datasets using the same format as the rest of the datasets.
* Added the appropriate test function in test_datasets.py.
* Added the GTZAN class in the datasets.rst documentation file.

* Addressed review issues in PR #668

* Added dummy noise .wav in `test/assets/`
* Removed transforms of input and output from the dataset
  `__init__` function, as well as the corresponding methods.
* Replaced rendundant `filtered` and `subset` methods from
  class initialization and also changed the corresponding
  assertion message.

* Fixed E303: too many blank lines error

* Added GTZAN to __init__.__all__

* Fixed incorrectly not importing GTZAN

* removed duplicate warning

* lint
Co-authored-by: default avatarVincent QB <vincentqb@users.noreply.github.com>
parent 1a297ef2
...@@ -33,6 +33,14 @@ COMMONVOICE ...@@ -33,6 +33,14 @@ COMMONVOICE
:special-members: :special-members:
GTZAN
~~~~~
.. autoclass:: GTZAN
:members: __getitem__
:special-members:
LIBRISPEECH LIBRISPEECH
~~~~~~~~~~~ ~~~~~~~~~~~
......
...@@ -7,6 +7,7 @@ from torchaudio.datasets.utils import diskcache_iterator, bg_iterator ...@@ -7,6 +7,7 @@ from torchaudio.datasets.utils import diskcache_iterator, bg_iterator
from torchaudio.datasets.vctk import VCTK from torchaudio.datasets.vctk import VCTK
from torchaudio.datasets.yesno import YESNO from torchaudio.datasets.yesno import YESNO
from torchaudio.datasets.ljspeech import LJSPEECH from torchaudio.datasets.ljspeech import LJSPEECH
from torchaudio.datasets.gtzan import GTZAN
from . import common_utils from . import common_utils
...@@ -55,6 +56,10 @@ class TestDatasets(unittest.TestCase): ...@@ -55,6 +56,10 @@ class TestDatasets(unittest.TestCase):
data = SPEECHCOMMANDS(self.path) data = SPEECHCOMMANDS(self.path)
data[0] data[0]
def test_gtzan(self):
data = GTZAN(self.path)
data[0]
if __name__ == "__main__": if __name__ == "__main__":
unittest.main() unittest.main()
...@@ -3,6 +3,7 @@ from .librispeech import LIBRISPEECH ...@@ -3,6 +3,7 @@ from .librispeech import LIBRISPEECH
from .speechcommands import SPEECHCOMMANDS from .speechcommands import SPEECHCOMMANDS
from .utils import bg_iterator, diskcache_iterator from .utils import bg_iterator, diskcache_iterator
from .vctk import VCTK from .vctk import VCTK
from .gtzan import GTZAN
from .yesno import YESNO from .yesno import YESNO
from .ljspeech import LJSPEECH from .ljspeech import LJSPEECH
...@@ -13,6 +14,7 @@ __all__ = ( ...@@ -13,6 +14,7 @@ __all__ = (
"VCTK", "VCTK",
"YESNO", "YESNO",
"LJSPEECH", "LJSPEECH",
"GTZAN",
"diskcache_iterator", "diskcache_iterator",
"bg_iterator", "bg_iterator",
) )
This diff is collapsed.
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment