Skip to content

Commit

Permalink
enh: adjust deep detection minDetections value dynamically based on o…
Browse files Browse the repository at this point in the history
…verlap value
  • Loading branch information
tphakala committed Nov 11, 2024
1 parent 7c7c6f2 commit 88c8849
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions internal/analysis/processor/processor.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"context"
"fmt"
"log"
"math"
"path/filepath"
"strings"
"sync"
Expand Down Expand Up @@ -387,13 +388,11 @@ func isSpeciesIncluded(species string, includedList []string) bool {
func (p *Processor) pendingDetectionsFlusher() {
// Determine minDetections based on Settings.BirdNET.Overlap
var minDetections int
if p.Settings.BirdNET.Overlap >= 2.7 {
// Use deep detection to avoid false positives
minDetections = 4
} else {
// Use single detection
minDetections = 1
}

// Calculate segment length based on overlap setting, minimum 0.1 seconds
segmentLength := math.Max(0.1, 3.0-p.Settings.BirdNET.Overlap)
// Calculate minimum detections needed based on segment length, at least 1
minDetections = int(math.Max(1, 3/segmentLength))

go func() {
// Create a ticker that ticks every second to frequently check for flush deadlines.
Expand Down

0 comments on commit 88c8849

Please sign in to comment.