Skip to content

Commit

Permalink
Revert "experiment(pyannote): probability"
Browse files Browse the repository at this point in the history
This reverts commit 47c12c3.

It doesn't add significant signal over the recommended algorithm.
  • Loading branch information
jpohhhh committed Dec 17, 2024
1 parent 47c12c3 commit 33dc1a3
Showing 1 changed file with 0 additions and 15 deletions.
15 changes: 0 additions & 15 deletions lib/models/pyannote/pyannote_isolate.dart
Original file line number Diff line number Diff line change
Expand Up @@ -265,9 +265,6 @@ Future<List<Map<String, dynamic>>> _processAudioInIsolate(
List<Map<String, dynamic>> results = [];
List<bool> isActive = List.filled(PyannoteONNX.numSpeakers, false);
List<int> startSamples = List.filled(PyannoteONNX.numSpeakers, 0);
// Add near where isActive and startSamples are declared
final probSums = List<double>.filled(PyannoteONNX.numSpeakers, 0.0);
final framesCounted = List<int>.filled(PyannoteONNX.numSpeakers, 0);
int currentSamples = 721;

final overlap = sample2frame(PyannoteONNX.duration - step);
Expand Down Expand Up @@ -374,29 +371,18 @@ Future<List<Map<String, dynamic>>> _processAudioInIsolate(
currentSamples += 270;
for (int spk = 0; spk < PyannoteONNX.numSpeakers; spk++) {
if (isActive[spk]) {
// Add probability tracking
probSums[spk] += probs[spk];
framesCounted[spk]++;

if (probs[spk] < 0.5) {
results.add({
'speaker': spk,
'start': startSamples[spk] / PyannoteONNX.sampleRate,
'stop': currentSamples / PyannoteONNX.sampleRate,
'probability': probSums[spk] / framesCounted[spk], // Add average probability
});
isActive[spk] = false;
// Reset tracking for this speaker
probSums[spk] = 0.0;
framesCounted[spk] = 0;
}
} else {
if (probs[spk] > 0.5) {
startSamples[spk] = currentSamples;
isActive[spk] = true;
// Start tracking probability
probSums[spk] = probs[spk];
framesCounted[spk] = 1;
}
}
}
Expand All @@ -416,7 +402,6 @@ Future<List<Map<String, dynamic>>> _processAudioInIsolate(
'speaker': spk,
'start': startSamples[spk] / PyannoteONNX.sampleRate,
'stop': currentSamples / PyannoteONNX.sampleRate,
'probability': probSums[spk] / framesCounted[spk], // Add average probability
});
}
}
Expand Down

0 comments on commit 33dc1a3

Please sign in to comment.