Commit 2d5520b9 authored by Anthony Larcher's avatar Anthony Larcher
Browse files

Merge branch 'dev_al' of https://git-lium.univ-lemans.fr/Larcher/sidekit into dev_al

parents 6f10df46 70559eeb
......@@ -353,7 +353,6 @@ class SpkSet(Dataset):
self.sessions = df
# Create lists for each column of the dataframe
weight_dict = dict()
spk_dict = dict()
# For each segment, get all possible segments with the current overlap
......@@ -375,7 +374,7 @@ class SpkSet(Dataset):
for jdx, possible_start in enumerate(possible_starts):
segment_dict = dict()
segment_dict['start'] = possible_start
segment_dict['start'] = possible_start / self.sample_rate
segment_dict['duration'] = self.duration
segment_dict['file_id'] = current_session.file_id
......@@ -387,7 +386,7 @@ class SpkSet(Dataset):
segment_dict['file_id'] = current_session.file_id
spk_dict[current_session.speaker_id]['segments'].append(segment_dict)
self.weights = weight_dict
self._spk_dict = spk_dict
self._spk_index = list(spk_dict.keys())
self.len = len(self._spk_index)
......@@ -460,8 +459,13 @@ class SpkSet(Dataset):
nfo = soundfile.info(f"{self.data_path}/{current_segment['file_id']}{self.data_file_extension}")
if self._windowed:
start_frame = current_segment['start']
start_frame = int(current_segment['start'] * self.sample_rate)
if start_frame + self.sample_number >= nfo.frames:
start_frame = numpy.min(nfo.frames - self.sample_number - 1)
stop_frame = start_frame + self.sample_number
#start_frame = current_segment['start']
#stop_frame = start_frame + self.sample_number
else:
start_frame = int(current_segment['start'] * self.sample_rate)
stop_frame = int(current_segment['duration'] * self.sample_rate)
......@@ -586,7 +590,6 @@ class SideSet(Dataset):
# Create lists for each column of the dataframe
df_dict = dict(zip(df.columns, [[], [], [], [], [], [], []]))
weight_dict = dict()
# For each segment, get all possible segments with the current overlap
for idx in tqdm.trange(len(tmp_sessions), desc='indexing all ' + set_type + ' segments', mininterval=1):
......@@ -615,14 +618,9 @@ class SideSet(Dataset):
df_dict["duration"].append(self.duration)
df_dict["speaker_idx"].append(current_session.speaker_idx)
df_dict["gender"].append(current_session.gender)
if current_session.speaker_idx in weight_dict:
weight_dict[current_session.speaker_idx] += 1
else:
weight_dict[current_session.speaker_idx] = 1
self.sessions = pandas.DataFrame.from_dict(df_dict)
self.len = len(self.sessions)
self.weights = weight_dict
_transform = []
if (self.transformation["pipeline"] != '') and (self.transformation["pipeline"] is not None):
......
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