Ejemplo n.º 1
0
 def test_dataset_names(self):
     for dataset_name, dataset_type in self.datasets.items():
         with pytest.raises(RuntimeError):
             _ = get_dataset(
                 dataset_name, "./data/audio", subset="train", download=False
             )
Ejemplo n.º 2
0
 def test_custom_audio_dataset(self):
     audio_dataset = get_dataset(
         "audio", "./tests/data/audioset", subset="train", download=False
     )
     assert type(audio_dataset) == AUDIO
     assert len(audio_dataset) == 1
Ejemplo n.º 3
0
            RandomApply([
                PitchShift(
                    n_samples=args.audio_length,
                    sample_rate=args.sample_rate,
                )
            ],
                        p=args.transforms_pitch),
            RandomApply([Reverb(sample_rate=args.sample_rate)],
                        p=args.transforms_reverb)
        ]
        num_augmented_samples = 2

    # ------------
    # dataloaders
    # ------------
    train_dataset = get_dataset(args.dataset, args.dataset_dir, subset="train")
    valid_dataset = get_dataset(args.dataset, args.dataset_dir, subset="valid")
    contrastive_train_dataset = ContrastiveDataset(
        train_dataset,
        input_shape=(1, args.audio_length),
        transform=ComposeMany(train_transform,
                              num_augmented_samples=num_augmented_samples),
    )

    contrastive_valid_dataset = ContrastiveDataset(
        valid_dataset,
        input_shape=(1, args.audio_length),
        transform=ComposeMany(train_transform,
                              num_augmented_samples=num_augmented_samples),
    )