add kwargs to all the model implemnetations
Browse files
birdnet_custom_v2.4/model.py
CHANGED
@@ -49,6 +49,7 @@ class Model(ModelBase):
|
|
49 |
model_path: str = None,
|
50 |
sigmoid_sensitivity: float = 1.0,
|
51 |
num_threads: int = 1,
|
|
|
52 |
):
|
53 |
|
54 |
self.default_model_path = str(Path(default_model_path) / "model.tflite")
|
@@ -78,6 +79,7 @@ class Model(ModelBase):
|
|
78 |
labels_path=classifier_labels_path,
|
79 |
num_threads=num_threads,
|
80 |
sensitivity=sigmoid_sensitivity,
|
|
|
81 |
)
|
82 |
|
83 |
def load_model(self):
|
|
|
49 |
model_path: str = None,
|
50 |
sigmoid_sensitivity: float = 1.0,
|
51 |
num_threads: int = 1,
|
52 |
+
**kwargs
|
53 |
):
|
54 |
|
55 |
self.default_model_path = str(Path(default_model_path) / "model.tflite")
|
|
|
79 |
labels_path=classifier_labels_path,
|
80 |
num_threads=num_threads,
|
81 |
sensitivity=sigmoid_sensitivity,
|
82 |
+
**kwargs
|
83 |
)
|
84 |
|
85 |
def load_model(self):
|
birdnet_custom_v2.4/preprocessor.py
CHANGED
@@ -14,6 +14,7 @@ class Preprocessor(ppb.PreprocessorBase):
|
|
14 |
overlap: float = 0.0,
|
15 |
sample_secs: int = 3.0,
|
16 |
resample_type: str = "kaiser_fast",
|
|
|
17 |
):
|
18 |
"""
|
19 |
__init__ Construct a new preprocesssor for custom birdnet classifiers from given parameters, and use defaults for the ones not present.
|
@@ -31,6 +32,7 @@ class Preprocessor(ppb.PreprocessorBase):
|
|
31 |
overlap=overlap,
|
32 |
sample_secs=sample_secs,
|
33 |
resample_type=resample_type,
|
|
|
34 |
)
|
35 |
|
36 |
def process_audio_data(self, rawdata: np.ndarray) -> list:
|
|
|
14 |
overlap: float = 0.0,
|
15 |
sample_secs: int = 3.0,
|
16 |
resample_type: str = "kaiser_fast",
|
17 |
+
**kwargs
|
18 |
):
|
19 |
"""
|
20 |
__init__ Construct a new preprocesssor for custom birdnet classifiers from given parameters, and use defaults for the ones not present.
|
|
|
32 |
overlap=overlap,
|
33 |
sample_secs=sample_secs,
|
34 |
resample_type=resample_type,
|
35 |
+
**kwargs
|
36 |
)
|
37 |
|
38 |
def process_audio_data(self, rawdata: np.ndarray) -> list:
|
birdnet_default_v2.4/model.py
CHANGED
@@ -18,6 +18,7 @@ class Model(ModelBase):
|
|
18 |
num_threads: int = 1,
|
19 |
sigmoid_sensitivity: float = 1.0,
|
20 |
species_list_file: str = None,
|
|
|
21 |
):
|
22 |
"""
|
23 |
__init__ Create a new model instance that uses birdnet-analyzer models for bird species classification
|
@@ -43,6 +44,7 @@ class Model(ModelBase):
|
|
43 |
labels_path,
|
44 |
num_threads=num_threads,
|
45 |
sensitivity=sigmoid_sensitivity,
|
|
|
46 |
)
|
47 |
|
48 |
# store input and output index to not have to retrieve them each time an inference is made
|
|
|
18 |
num_threads: int = 1,
|
19 |
sigmoid_sensitivity: float = 1.0,
|
20 |
species_list_file: str = None,
|
21 |
+
**kwargs
|
22 |
):
|
23 |
"""
|
24 |
__init__ Create a new model instance that uses birdnet-analyzer models for bird species classification
|
|
|
44 |
labels_path,
|
45 |
num_threads=num_threads,
|
46 |
sensitivity=sigmoid_sensitivity,
|
47 |
+
**kwargs
|
48 |
)
|
49 |
|
50 |
# store input and output index to not have to retrieve them each time an inference is made
|
birdnet_default_v2.4/preprocessor.py
CHANGED
@@ -14,6 +14,7 @@ class Preprocessor(ppb.PreprocessorBase):
|
|
14 |
overlap: float = 0.0,
|
15 |
sample_secs: int = 3.0,
|
16 |
resample_type: str = "kaiser_fast",
|
|
|
17 |
):
|
18 |
"""
|
19 |
__init__ Construct a new preprocesssor for custom birdnet classifiers from given parameters, and use defaults for the ones not present.
|
@@ -31,6 +32,7 @@ class Preprocessor(ppb.PreprocessorBase):
|
|
31 |
overlap=overlap,
|
32 |
sample_secs=sample_secs,
|
33 |
resample_type=resample_type,
|
|
|
34 |
)
|
35 |
|
36 |
def process_audio_data(self, rawdata: np.ndarray) -> list:
|
|
|
14 |
overlap: float = 0.0,
|
15 |
sample_secs: int = 3.0,
|
16 |
resample_type: str = "kaiser_fast",
|
17 |
+
**kwargs
|
18 |
):
|
19 |
"""
|
20 |
__init__ Construct a new preprocesssor for custom birdnet classifiers from given parameters, and use defaults for the ones not present.
|
|
|
32 |
overlap=overlap,
|
33 |
sample_secs=sample_secs,
|
34 |
resample_type=resample_type,
|
35 |
+
**kwargs
|
36 |
)
|
37 |
|
38 |
def process_audio_data(self, rawdata: np.ndarray) -> list:
|
google_bird_classification/model.py
CHANGED
@@ -7,7 +7,7 @@ import pandas as pd
|
|
7 |
|
8 |
class Model(ModelBase):
|
9 |
|
10 |
-
def __init__(self, model_path: str, num_threads: int = 1, species_list_file=None):
|
11 |
"""
|
12 |
__init__ Create a new Model instance using the google perch model.
|
13 |
|
@@ -26,6 +26,7 @@ class Model(ModelBase):
|
|
26 |
model_path,
|
27 |
labels_path,
|
28 |
num_threads=num_threads,
|
|
|
29 |
# sensitivity kwarg doesn't exist here
|
30 |
) # num_threads doesn't do anything here.
|
31 |
|
|
|
7 |
|
8 |
class Model(ModelBase):
|
9 |
|
10 |
+
def __init__(self, model_path: str, num_threads: int = 1, species_list_file=None, **kwargs):
|
11 |
"""
|
12 |
__init__ Create a new Model instance using the google perch model.
|
13 |
|
|
|
26 |
model_path,
|
27 |
labels_path,
|
28 |
num_threads=num_threads,
|
29 |
+
**kwargs
|
30 |
# sensitivity kwarg doesn't exist here
|
31 |
) # num_threads doesn't do anything here.
|
32 |
|
google_bird_classification/preprocessor.py
CHANGED
@@ -35,6 +35,7 @@ class Preprocessor(ppb.PreprocessorBase):
|
|
35 |
sample_rate=sample_rate,
|
36 |
sample_secs=sample_secs,
|
37 |
resample_type=resample_type,
|
|
|
38 |
)
|
39 |
|
40 |
def process_audio_data(self, rawdata: np.array) -> np.array:
|
|
|
35 |
sample_rate=sample_rate,
|
36 |
sample_secs=sample_secs,
|
37 |
resample_type=resample_type,
|
38 |
+
**kwargs
|
39 |
)
|
40 |
|
41 |
def process_audio_data(self, rawdata: np.array) -> np.array:
|