Skip to content

Commit b63a29d

Browse files
Updated flat sigmoid to match birdnet_analyzer (#25)
* Updated flat sigmoid to match birdnet_analyzer * add changelog --------- Co-authored-by: Stefan Taubert <23339395+stefantaubert@users.noreply.github.com>
1 parent a777560 commit b63a29d

2 files changed

Lines changed: 7 additions & 2 deletions

File tree

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1212
- Added convenience functions to export embeddings by @Josef-Haupt
1313
- Added some code documentation
1414

15+
### Changed
16+
17+
- Updated flat sigmoid to match birdnet_analyzer by @Josef-Haupt
18+
1519
### Bugfixes
1620

1721
- Fixed issue with one test on Python 3.11 & 3.12

src/birdnet/utils/helper.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -316,9 +316,10 @@ def fillup_with_silence(
316316

317317

318318
def flat_sigmoid_logaddexp_fast(
319-
x: npt.NDArray, sensitivity: float, clip_val: float = 15.0
319+
x: npt.NDArray, sensitivity: float, clip_val: float = 15.0, bias: float = 1.0
320320
) -> npt.NDArray:
321-
y = sensitivity * np.clip(x, -clip_val, clip_val)
321+
transformed_bias = (bias - 1.0) * 10.0
322+
y = sensitivity * np.clip(x + transformed_bias, -clip_val, clip_val)
322323

323324
positive_mask = y >= 0
324325
abs_y = np.abs(y)

0 commit comments

Comments
 (0)