Skip to content

Commit

Permalink
added external dataset folder root initialization file
Browse files Browse the repository at this point in the history
  • Loading branch information
FBurkhardt committed Feb 21, 2022
1 parent 3bb4bcd commit 8d7a1bd
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 11 deletions.
11 changes: 10 additions & 1 deletion src/dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
from util import Util
from plots import Plots
import glob_conf
import configparser

class Dataset:
""" Class to represent datasets"""
Expand All @@ -28,7 +29,15 @@ def __init__(self, name):
def load(self):
"""Load the dataframe with files, speakers and task labels"""
self.util.debug(f'loading {self.name}')
root = glob_conf.config['DATA'][self.name]
data_roots = self.util.config_val('DATA', 'root_folders', False)
if data_roots:
# if there is a global data rootfolder file, read from there
roots = configparser.ConfigParser()
roots.read(data_roots)
root = roots['Data_folders'][self.name]
else:
# else there should be one in the experiment ini
root = glob_conf.config['DATA'][self.name]
db = audformat.Database.load(root)
# map the audio file paths
db.map_files(lambda x: os.path.join(root, x))
Expand Down
10 changes: 6 additions & 4 deletions tests/exp_bdtg.ini
Original file line number Diff line number Diff line change
@@ -1,20 +1,22 @@
[EXP]
root = ./tests/
name = exp_bdtg
name = exp_austrian_parl
runs = 1
epochs = 1
type = regression
[DATA]
databases = ['bdtg']
bdtg = /home/felix/data/audb/bundestag-age/3.1.0/d3b62a9b/
root_folders = data_roots.ini
#bdtg = /home/felix/data/audb/bundestag-age/3.1.0/d3b62a9b/
bdtg.files_tables = ['files']
bdtg.split_strategy = specified
bdtg.test_tables = ['age.test']
bdtg.train_tables = ['age.train']
bdtg.limit = 1000
#bdtg.limit = 1000
bdtg.value_counts = True
target = age
labels = ['u40', '40ies', '50ies', '60ies', 'ü70']
bins = [-1000, 40, 50, 60, 70, 1000]
bins = [-1000, 40, 50, 60, 70, 1000]
[FEATS]
type = os
needs_feature_extraction = True
Expand Down
3 changes: 1 addition & 2 deletions tests/exp_cross.ini
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,13 @@ epochs = 10
save = True
[DATA]
databases = ['emodb', 'polish']
root_folders = data_roots.ini
trains = ['emodb']
tests = ['polish']
target = emotion
strategy = cross_data
emodb = /home/felix/data/audb/emodb/
emodb.mapping = {'anger':'angry', 'happiness':'happy', 'sadness':'sad', 'neutral':'neutral'}
emodb.value_counts = True
polish = /home/felix/data/audb/polish-emotional-speech/
polish.mapping = {'anger':'angry', 'joy':'happy', 'sadness':'sad', 'neutral':'neutral'}
polish.value_counts = True
labels = ['angry', 'happy', 'neutral', 'sad']
Expand Down
12 changes: 8 additions & 4 deletions tests/exp_emodb.ini
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,20 @@ epochs = 1
save = True
[DATA]
databases = ['emodb']
emodb = /home/felix/data/audb/emodb/
root_folders = data_roots.ini
emodb.split_strategy = speaker_split
emodb.mapping = {'anger':'angry', 'happiness':'happy', 'sadness':'sad', 'neutral':'neutral'}
emodb.testsplit = 40
#emodb.mapping = {'anger':'angry', 'happiness':'happy', 'sadness':'sad', 'neutral':'neutral'}
emodb.value_counts = True
target = emotion
labels = ['angry', 'happy', 'neutral', 'sad']
#labels = ['angry', 'happy', 'neutral', 'sad']
labels = ['anger', 'boredom', 'disgust', 'fear', 'happiness', 'neutral', 'sadness']
[FEATS]
#type = trill
type = os
scale = standard
[MODEL]
type = xgb
type = svm
save = True
[PLOT]
value_counts = True
Expand Down

0 comments on commit 8d7a1bd

Please sign in to comment.