-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'tweetynet_integrations' into TweetyNet_integrations_2_main
- Loading branch information
Showing
25 changed files
with
3,755 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
.ipynb_checkpoints | ||
PyHa/__pycache__ | ||
PyHa/microfaune_package/microfaune/__pycache__ | ||
PyHa/microfaune_package/microfaune/__pycache__ | ||
PyHa/tweetynet_package/tweetynet/__pycache__ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
from torch.utils.data import Dataset | ||
|
||
class CustomAudioDataset(Dataset): | ||
def __init__(self, spec, annotations, uids, transform=None, target_transform=None): | ||
self.img_labels = annotations | ||
self.spec = spec | ||
self.uids = uids | ||
self.transform = transform | ||
self.target_transform = target_transform | ||
|
||
def __len__(self): | ||
return len(self.img_labels) | ||
|
||
def __getitem__(self, idx): | ||
#img_path = os.path.join(self.img_dir, self.img_labels[idx, 0]) | ||
#Read_audio | ||
image = self.spec[idx]#read_image(img_path) | ||
label = self.img_labels[idx] | ||
# transform should be spectrogram from librosa # unless we do that beforehand. | ||
if self.transform: | ||
image = self.transform(image) | ||
if self.target_transform: | ||
label = self.target_transform(label) | ||
return image, label, self.uids[idx] | ||
|
Oops, something went wrong.