rename iSparrow to faunanet
Browse files- birdnet_custom_v2.4/default.yml +3 -3
- birdnet_custom_v2.4/model.py +6 -6
- birdnet_custom_v2.4/preprocessor.py +1 -1
- birdnet_default_v2.4/default.yml +3 -3
- birdnet_default_v2.4/model.py +5 -5
- birdnet_default_v2.4/preprocessor.py +1 -1
- google_bird_classification/default.yml +3 -3
- google_bird_classification/model.py +4 -4
- google_bird_classification/preprocessor.py +1 -1
- google_perch_lite/default.yml +3 -3
- google_perch_lite/model.py +8 -8
- google_perch_lite/preprocessor.py +1 -1
birdnet_custom_v2.4/default.yml
CHANGED
|
@@ -17,11 +17,11 @@ Analysis:
|
|
| 17 |
pattern: ".wav"
|
| 18 |
check_time: 1
|
| 19 |
delete_recordings: "never"
|
| 20 |
-
model_dir: ~/
|
| 21 |
|
| 22 |
Data:
|
| 23 |
-
input: ~/
|
| 24 |
-
output: ~/
|
| 25 |
Preprocessor:
|
| 26 |
sample_rate: 48000
|
| 27 |
overlap: 0.0
|
|
|
|
| 17 |
pattern: ".wav"
|
| 18 |
check_time: 1
|
| 19 |
delete_recordings: "never"
|
| 20 |
+
model_dir: ~/faunanet/models
|
| 21 |
|
| 22 |
Data:
|
| 23 |
+
input: ~/faunanet_data
|
| 24 |
+
output: ~/faunanet_output
|
| 25 |
Preprocessor:
|
| 26 |
sample_rate: 48000
|
| 27 |
overlap: 0.0
|
birdnet_custom_v2.4/model.py
CHANGED
|
@@ -8,8 +8,8 @@ except Exception:
|
|
| 8 |
|
| 9 |
from birdnetlib.analyzer import AnalyzerConfigurationError
|
| 10 |
|
| 11 |
-
from
|
| 12 |
-
from
|
| 13 |
|
| 14 |
|
| 15 |
class Model(ModelBase):
|
|
@@ -193,12 +193,12 @@ class Model(ModelBase):
|
|
| 193 |
return confidence
|
| 194 |
|
| 195 |
@classmethod
|
| 196 |
-
def from_cfg(cls,
|
| 197 |
"""
|
| 198 |
from_cfg Create a new instance from a dictionary containing keyword arguments. Usually loaded from a config file.
|
| 199 |
|
| 200 |
Args:
|
| 201 |
-
|
| 202 |
cfg (dict): Dictionary containing the keyword arguments
|
| 203 |
|
| 204 |
Returns:
|
|
@@ -207,9 +207,9 @@ class Model(ModelBase):
|
|
| 207 |
|
| 208 |
# preprocess config because we need two models here
|
| 209 |
cfg["default_model_path"] = str(
|
| 210 |
-
Path(
|
| 211 |
)
|
| 212 |
cfg["model_path"] = str(
|
| 213 |
-
Path(
|
| 214 |
)
|
| 215 |
return cls(**cfg)
|
|
|
|
| 8 |
|
| 9 |
from birdnetlib.analyzer import AnalyzerConfigurationError
|
| 10 |
|
| 11 |
+
from faunanet.model_base import ModelBase
|
| 12 |
+
from faunanet import utils
|
| 13 |
|
| 14 |
|
| 15 |
class Model(ModelBase):
|
|
|
|
| 193 |
return confidence
|
| 194 |
|
| 195 |
@classmethod
|
| 196 |
+
def from_cfg(cls, faunanet_dir: str, cfg: dict):
|
| 197 |
"""
|
| 198 |
from_cfg Create a new instance from a dictionary containing keyword arguments. Usually loaded from a config file.
|
| 199 |
|
| 200 |
Args:
|
| 201 |
+
faunanet_dir (str): Installation directory of the faunanet package
|
| 202 |
cfg (dict): Dictionary containing the keyword arguments
|
| 203 |
|
| 204 |
Returns:
|
|
|
|
| 207 |
|
| 208 |
# preprocess config because we need two models here
|
| 209 |
cfg["default_model_path"] = str(
|
| 210 |
+
Path(faunanet_dir) / Path("models") / Path("birdnet_default")
|
| 211 |
)
|
| 212 |
cfg["model_path"] = str(
|
| 213 |
+
Path(faunanet_dir) / Path("models") / Path(cfg["model_path"])
|
| 214 |
)
|
| 215 |
return cls(**cfg)
|
birdnet_custom_v2.4/preprocessor.py
CHANGED
|
@@ -1,5 +1,5 @@
|
|
| 1 |
import numpy as np
|
| 2 |
-
import
|
| 3 |
|
| 4 |
|
| 5 |
class Preprocessor(ppb.PreprocessorBase):
|
|
|
|
| 1 |
import numpy as np
|
| 2 |
+
import faunanet.preprocessor_base as ppb
|
| 3 |
|
| 4 |
|
| 5 |
class Preprocessor(ppb.PreprocessorBase):
|
birdnet_default_v2.4/default.yml
CHANGED
|
@@ -17,11 +17,11 @@ Analysis:
|
|
| 17 |
pattern: ".wav"
|
| 18 |
check_time: 1
|
| 19 |
delete_recordings: "never"
|
| 20 |
-
model_dir: ~/
|
| 21 |
|
| 22 |
Data:
|
| 23 |
-
input: ~/
|
| 24 |
-
output: ~/
|
| 25 |
Preprocessor:
|
| 26 |
sample_rate: 48000
|
| 27 |
overlap: 0.0
|
|
|
|
| 17 |
pattern: ".wav"
|
| 18 |
check_time: 1
|
| 19 |
delete_recordings: "never"
|
| 20 |
+
model_dir: ~/faunanet/models
|
| 21 |
|
| 22 |
Data:
|
| 23 |
+
input: ~/faunanet_data
|
| 24 |
+
output: ~/faunanet_output
|
| 25 |
Preprocessor:
|
| 26 |
sample_rate: 48000
|
| 27 |
overlap: 0.0
|
birdnet_default_v2.4/model.py
CHANGED
|
@@ -1,9 +1,9 @@
|
|
| 1 |
from pathlib import Path
|
| 2 |
import numpy as np
|
| 3 |
|
| 4 |
-
from
|
| 5 |
|
| 6 |
-
# from
|
| 7 |
|
| 8 |
|
| 9 |
class Model(ModelBase):
|
|
@@ -92,19 +92,19 @@ class Model(ModelBase):
|
|
| 92 |
return confidence
|
| 93 |
|
| 94 |
@classmethod
|
| 95 |
-
def from_cfg(cls,
|
| 96 |
"""
|
| 97 |
from_cfg Create a new instance from a dictionary containing keyword arguments. Usually loaded from a config file.
|
| 98 |
|
| 99 |
Args:
|
| 100 |
-
|
| 101 |
cfg (dict): Dictionary containing the keyword arguments
|
| 102 |
|
| 103 |
Returns:
|
| 104 |
Model: New model instance created with the supplied kwargs.
|
| 105 |
"""
|
| 106 |
cfg["model_path"] = str(
|
| 107 |
-
Path(
|
| 108 |
)
|
| 109 |
|
| 110 |
return cls(**cfg)
|
|
|
|
| 1 |
from pathlib import Path
|
| 2 |
import numpy as np
|
| 3 |
|
| 4 |
+
from faunanet.model_base import ModelBase
|
| 5 |
|
| 6 |
+
# from faunanet import utils
|
| 7 |
|
| 8 |
|
| 9 |
class Model(ModelBase):
|
|
|
|
| 92 |
return confidence
|
| 93 |
|
| 94 |
@classmethod
|
| 95 |
+
def from_cfg(cls, faunanet_folder: str, cfg: dict):
|
| 96 |
"""
|
| 97 |
from_cfg Create a new instance from a dictionary containing keyword arguments. Usually loaded from a config file.
|
| 98 |
|
| 99 |
Args:
|
| 100 |
+
faunanet_dir (str): Installation directory of the faunanet package
|
| 101 |
cfg (dict): Dictionary containing the keyword arguments
|
| 102 |
|
| 103 |
Returns:
|
| 104 |
Model: New model instance created with the supplied kwargs.
|
| 105 |
"""
|
| 106 |
cfg["model_path"] = str(
|
| 107 |
+
Path(faunanet_folder) / Path("models") / cfg["model_path"]
|
| 108 |
)
|
| 109 |
|
| 110 |
return cls(**cfg)
|
birdnet_default_v2.4/preprocessor.py
CHANGED
|
@@ -1,5 +1,5 @@
|
|
| 1 |
import numpy as np
|
| 2 |
-
import
|
| 3 |
|
| 4 |
|
| 5 |
class Preprocessor(ppb.PreprocessorBase):
|
|
|
|
| 1 |
import numpy as np
|
| 2 |
+
import faunanet.preprocessor_base as ppb
|
| 3 |
|
| 4 |
|
| 5 |
class Preprocessor(ppb.PreprocessorBase):
|
google_bird_classification/default.yml
CHANGED
|
@@ -19,11 +19,11 @@ Analysis:
|
|
| 19 |
pattern: ".wav"
|
| 20 |
check_time: 1
|
| 21 |
delete_recordings: "never"
|
| 22 |
-
model_dir: ~/
|
| 23 |
|
| 24 |
Data:
|
| 25 |
-
input: ~/
|
| 26 |
-
output: ~/
|
| 27 |
Preprocessor:
|
| 28 |
sample_rate: 32000
|
| 29 |
overlap: 0.0
|
|
|
|
| 19 |
pattern: ".wav"
|
| 20 |
check_time: 1
|
| 21 |
delete_recordings: "never"
|
| 22 |
+
model_dir: ~/faunanet/models
|
| 23 |
|
| 24 |
Data:
|
| 25 |
+
input: ~/faunanet_data
|
| 26 |
+
output: ~/faunanet_output
|
| 27 |
Preprocessor:
|
| 28 |
sample_rate: 32000
|
| 29 |
overlap: 0.0
|
google_bird_classification/model.py
CHANGED
|
@@ -1,7 +1,7 @@
|
|
| 1 |
from pathlib import Path
|
| 2 |
import numpy as np
|
| 3 |
import tensorflow as tf
|
| 4 |
-
from
|
| 5 |
import pandas as pd
|
| 6 |
|
| 7 |
|
|
@@ -48,12 +48,12 @@ class Model(ModelBase):
|
|
| 48 |
return results
|
| 49 |
|
| 50 |
@classmethod
|
| 51 |
-
def from_cfg(cls,
|
| 52 |
"""
|
| 53 |
from_cfg Create a new instance from a dictionary containing keyword arguments. Usually loaded from a config file.
|
| 54 |
|
| 55 |
Args:
|
| 56 |
-
|
| 57 |
cfg (dict): Dictionary containing the keyword arguments
|
| 58 |
|
| 59 |
Returns:
|
|
@@ -61,7 +61,7 @@ class Model(ModelBase):
|
|
| 61 |
"""
|
| 62 |
|
| 63 |
cfg["model_path"] = str(
|
| 64 |
-
Path(
|
| 65 |
)
|
| 66 |
|
| 67 |
return cls(**cfg)
|
|
|
|
| 1 |
from pathlib import Path
|
| 2 |
import numpy as np
|
| 3 |
import tensorflow as tf
|
| 4 |
+
from faunanet.model_base import ModelBase
|
| 5 |
import pandas as pd
|
| 6 |
|
| 7 |
|
|
|
|
| 48 |
return results
|
| 49 |
|
| 50 |
@classmethod
|
| 51 |
+
def from_cfg(cls, faunanet_folder: str, cfg: dict):
|
| 52 |
"""
|
| 53 |
from_cfg Create a new instance from a dictionary containing keyword arguments. Usually loaded from a config file.
|
| 54 |
|
| 55 |
Args:
|
| 56 |
+
faunanet_dir (str): Installation directory of the faunanet package
|
| 57 |
cfg (dict): Dictionary containing the keyword arguments
|
| 58 |
|
| 59 |
Returns:
|
|
|
|
| 61 |
"""
|
| 62 |
|
| 63 |
cfg["model_path"] = str(
|
| 64 |
+
Path(faunanet_folder) / Path("models") / Path(cfg["model_path"])
|
| 65 |
)
|
| 66 |
|
| 67 |
return cls(**cfg)
|
google_bird_classification/preprocessor.py
CHANGED
|
@@ -3,7 +3,7 @@ import numpy as np
|
|
| 3 |
|
| 4 |
from tensorflow.signal import frame as tf_split_signal_into_chunks
|
| 5 |
|
| 6 |
-
from
|
| 7 |
|
| 8 |
|
| 9 |
# README: work in progress - will be completed in separate issue
|
|
|
|
| 3 |
|
| 4 |
from tensorflow.signal import frame as tf_split_signal_into_chunks
|
| 5 |
|
| 6 |
+
from faunanet import preprocessor_base as ppb
|
| 7 |
|
| 8 |
|
| 9 |
# README: work in progress - will be completed in separate issue
|
google_perch_lite/default.yml
CHANGED
|
@@ -19,11 +19,11 @@ Analysis:
|
|
| 19 |
pattern: ".wav"
|
| 20 |
check_time: 1
|
| 21 |
delete_recordings: "never"
|
| 22 |
-
model_dir: ~/
|
| 23 |
|
| 24 |
Data:
|
| 25 |
-
input: ~/
|
| 26 |
-
output: ~/
|
| 27 |
Preprocessor:
|
| 28 |
sample_rate: 32000
|
| 29 |
overlap: 0.0
|
|
|
|
| 19 |
pattern: ".wav"
|
| 20 |
check_time: 1
|
| 21 |
delete_recordings: "never"
|
| 22 |
+
model_dir: ~/faunanet/models
|
| 23 |
|
| 24 |
Data:
|
| 25 |
+
input: ~/faunanet_data
|
| 26 |
+
output: ~/faunanet_output
|
| 27 |
Preprocessor:
|
| 28 |
sample_rate: 32000
|
| 29 |
overlap: 0.0
|
google_perch_lite/model.py
CHANGED
|
@@ -1,12 +1,12 @@
|
|
| 1 |
-
from
|
| 2 |
|
| 3 |
try:
|
| 4 |
import tflite_runtime.interpreter as tflite
|
| 5 |
except ImportError:
|
| 6 |
import tensorflow.lite as tflite
|
| 7 |
|
| 8 |
-
from
|
| 9 |
-
from
|
| 10 |
|
| 11 |
import numpy as np
|
| 12 |
from pathlib import Path
|
|
@@ -15,10 +15,10 @@ from scipy.special import softmax
|
|
| 15 |
|
| 16 |
class Model(ModelBase):
|
| 17 |
"""
|
| 18 |
-
Model Implementation of a
|
| 19 |
|
| 20 |
Args:
|
| 21 |
-
ModelBase (
|
| 22 |
"""
|
| 23 |
|
| 24 |
def __init__(self, model_path: str, num_threads: int = 1, **kwargs):
|
|
@@ -77,19 +77,19 @@ class Model(ModelBase):
|
|
| 77 |
return confidence
|
| 78 |
|
| 79 |
@classmethod
|
| 80 |
-
def from_cfg(cls,
|
| 81 |
"""
|
| 82 |
from_cfg Create a new instance from a dictionary containing keyword arguments. Usually loaded from a config file.
|
| 83 |
|
| 84 |
Args:
|
| 85 |
-
|
| 86 |
cfg (dict): Dictionary containing the keyword arguments
|
| 87 |
|
| 88 |
Returns:
|
| 89 |
Model: New model instance created with the supplied kwargs.
|
| 90 |
"""
|
| 91 |
cfg["model_name"] = str(
|
| 92 |
-
Path(
|
| 93 |
)
|
| 94 |
|
| 95 |
return cls(**cfg)
|
|
|
|
| 1 |
+
from faunanet.model_base import ModelBase
|
| 2 |
|
| 3 |
try:
|
| 4 |
import tflite_runtime.interpreter as tflite
|
| 5 |
except ImportError:
|
| 6 |
import tensorflow.lite as tflite
|
| 7 |
|
| 8 |
+
from faunanet import utils
|
| 9 |
+
from faunanet import ModelBase
|
| 10 |
|
| 11 |
import numpy as np
|
| 12 |
from pathlib import Path
|
|
|
|
| 15 |
|
| 16 |
class Model(ModelBase):
|
| 17 |
"""
|
| 18 |
+
Model Implementation of a faunanet model that uses the google perch tflite model.
|
| 19 |
|
| 20 |
Args:
|
| 21 |
+
ModelBase (faunanet.ModelBase): Model base class that provides the interface through which to interact with faunanet.
|
| 22 |
"""
|
| 23 |
|
| 24 |
def __init__(self, model_path: str, num_threads: int = 1, **kwargs):
|
|
|
|
| 77 |
return confidence
|
| 78 |
|
| 79 |
@classmethod
|
| 80 |
+
def from_cfg(cls, faunanet_folder: str, cfg: dict):
|
| 81 |
"""
|
| 82 |
from_cfg Create a new instance from a dictionary containing keyword arguments. Usually loaded from a config file.
|
| 83 |
|
| 84 |
Args:
|
| 85 |
+
faunanet_dir (str): Installation directory of the faunanet package
|
| 86 |
cfg (dict): Dictionary containing the keyword arguments
|
| 87 |
|
| 88 |
Returns:
|
| 89 |
Model: New model instance created with the supplied kwargs.
|
| 90 |
"""
|
| 91 |
cfg["model_name"] = str(
|
| 92 |
+
Path(faunanet_folder) / Path("models") / cfg["model_name"]
|
| 93 |
)
|
| 94 |
|
| 95 |
return cls(**cfg)
|
google_perch_lite/preprocessor.py
CHANGED
|
@@ -1,5 +1,5 @@
|
|
| 1 |
import numpy as np
|
| 2 |
-
import
|
| 3 |
|
| 4 |
|
| 5 |
class Preprocessor(ppb.PreprocessorBase):
|
|
|
|
| 1 |
import numpy as np
|
| 2 |
+
import faunanet.preprocessor_base as ppb
|
| 3 |
|
| 4 |
|
| 5 |
class Preprocessor(ppb.PreprocessorBase):
|