Skip to content

Commit

Permalink
initial release
Browse files Browse the repository at this point in the history
  • Loading branch information
tphakala committed Oct 20, 2023
0 parents commit 0c877b9
Show file tree
Hide file tree
Showing 12 changed files with 7,408 additions and 0 deletions.
6,522 changes: 6,522 additions & 0 deletions BirdNET_GLOBAL_6K_V2.4_Labels.txt

Large diffs are not rendered by default.

Binary file added BirdNET_GLOBAL_6K_V2.4_MData_Model_FP16.tflite
Binary file not shown.
Binary file added BirdNET_GLOBAL_6K_V2.4_Model_FP16.tflite
Binary file not shown.
Binary file added BirdNET_GLOBAL_6K_V2.4_Model_FP32.tflite
Binary file not shown.
Binary file added BirdNET_GLOBAL_6K_V2.4_Model_INT8.tflite
Binary file not shown.
360 changes: 360 additions & 0 deletions LICENSE

Large diffs are not rendered by default.

82 changes: 82 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
# Go-BirdNet

Golang implementation of Birdnet Analyzer.

Go-BirdNet is an application inspired by BirdNet Analyzer, developed by the K. Lisa Yang Center for Conservation Bioacoustics at the Cornell Lab of Ornithology and Chemnitz University of Technology. While the original BirdNet is based on Python, Go-BirdNet is built using Golang, aiming for simplified deployment across multiple platforms, from Windows PCs to single board computers like Raspberry Pi.

Currently, Go-BirdNet supports the analysis of WAV files only, support for other audio file formats is planned. Use of metadata model for location-based filtering is not yet implemented. This is very much of work in progress, and contributions and feedback are welcome.

## Dependencies

Go-BirdNet primarily relies on go-tflite by Yasuhiro Matsumoto (a.k.a. mattn). Go-tflite provides a Go binding for the TensorFlow Lite C API. Although go-tflite is documented to support only TensorFlow Lite version 2.2.0-rc3, I have successfully compiled it against version 2.14.0. As go-tflite is a C API binding compiled binary is not statically linked one, it is depending on libtensorflowlite_c.so to be present on deployment target system.

A crucial component is the BirdNet tflite model. After all, Go-BirdNet essentially serves as an interface to this model, with the core detection functionality residing within the BirdNet tflite model itself.

## Compiling

### Building TensorFlow Lite

Build tflite with cmake
```
sudo apt-get install cmake
```

Clone tensorflow repository
```
git clone https://github.com/tensorflow/tensorflow.git tensorflow_src
```

Create cmake build directory
```
mkdir tflite_build
cd tflite_build
```

Run cmake
```
cmake ../tensorflow_src/tensorflow/lite
```

Build tflite, In the tflite_build directory do
```
cmake --build . -j
```

Copy compiled libtensorflowlite_c.so to /usr/local/lib

### Building Go-BirdNet

Clone go-birdnet repository
```
https://github.com/tphakala/go-birdnet.git
```

Add CGO_CFLAGS and point it to directory you cloned tensorflow source in
```
export CGO_CFLAGS=-I$HOME/src/tensorflow/tensorflow_src
```

Build Go-BirdNet
```
cd go-birdnet
go build birdnet.go
```

## Usage

```
$ ./birdnet -h
Usage of ./birdnet:
-input string
Path to the input audio file (WAV)
-model string
Path to the model file (default "BirdNET_GLOBAL_6K_V2.4_Model_FP32.tflite")
-overlap float
Overlap value between 0.0 and 2.9
-sensitivity float
Sigmoid sensitivity value between 0.0 and 1.5 (default 1)
```

## License

Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International
Loading

0 comments on commit 0c877b9

Please sign in to comment.