Skip to content

Custom Dataloader That Creates Mini-Batchs of Spectrogram Features for Classification of Sound Using Pytorch

Notifications You must be signed in to change notification settings

achyutmani/SoundLoader-A-Function-To-Create-Dataloader-in-PyTorch-for-An-Environmental-Sound-Classification

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 

Repository files navigation

SoundLoader: A Function To Create Custom Dataloader in PyTorch for An Environmental Sound Classification

Import Classes from SoundCustomDataloader_Train.py and SoundCustomDataloader_Test.py to Get the Training and Test Dataset for Sound Classification. Forward this dataset as an argument to dataloader in PyTorch.
Sample Example Code:

  1. import torch
  2. from torch.utils.data import DataLoader
  3. from torchvision.transforms import transforms
  4. from SoundCustomDataloader_Train import Sound_Data_Train
  5. from SoundCustomDataloader_Test import Sound_Data_Test
  6. transform = transforms.Compose([transforms.Resize([224,224]),transforms.ToTensor(),transforms.Normalize(mean=[0.485], std=[0.229])])
  7. batch_size=32
  8. Training_Data=Sound_Data_Train(transform=transform)
  9. Test_Data=Sound_Data_Test(transform=transform)
  10. Train_loader=DataLoader(dataset=Train_Data,batch_size=batch_size,shuffle=True) # Pytorch dataloader for Training
  11. Test_loader=DataLoader(dataset=Test_Data,batch_size=batch_size,shuffle=True) Pytorch dataloader for Test

About

Custom Dataloader That Creates Mini-Batchs of Spectrogram Features for Classification of Sound Using Pytorch

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages