britekit 0.0.9__py3-none-any.whl → 0.0.11__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of britekit might be problematic. Click here for more details.

Files changed (41) hide show
  1. britekit/__about__.py +1 -1
  2. britekit/commands/_analyze.py +1 -1
  3. britekit/commands/_ckpt_ops.py +1 -1
  4. britekit/commands/_db_add.py +4 -4
  5. britekit/commands/_db_delete.py +7 -7
  6. britekit/commands/_embed.py +1 -1
  7. britekit/commands/_ensemble.py +3 -13
  8. britekit/commands/_extract.py +2 -2
  9. britekit/commands/_find_dup.py +1 -1
  10. britekit/commands/_pickle.py +1 -1
  11. britekit/commands/_plot.py +3 -3
  12. britekit/commands/_reextract.py +1 -1
  13. britekit/commands/_reports.py +4 -4
  14. britekit/commands/_search.py +1 -1
  15. britekit/commands/_train.py +2 -2
  16. britekit/commands/_tune.py +5 -1
  17. britekit/core/analyzer.py +1 -1
  18. britekit/core/audio.py +1 -1
  19. britekit/core/config_loader.py +13 -7
  20. britekit/core/data_module.py +1 -1
  21. britekit/core/dataset.py +1 -1
  22. britekit/core/pickler.py +1 -1
  23. britekit/core/plot.py +1 -1
  24. britekit/core/predictor.py +1 -1
  25. britekit/core/reextractor.py +1 -1
  26. britekit/core/trainer.py +1 -1
  27. britekit/core/tuner.py +1 -1
  28. britekit/core/util.py +3 -3
  29. britekit/models/base_model.py +1 -1
  30. britekit/models/model_loader.py +1 -1
  31. britekit/models/timm_model.py +1 -1
  32. britekit/testing/per_minute_tester.py +1 -1
  33. britekit/testing/per_recording_tester.py +1 -1
  34. britekit/testing/per_segment_tester.py +1 -1
  35. britekit/training_db/extractor.py +1 -1
  36. britekit/training_db/training_db.py +0 -2
  37. {britekit-0.0.9.dist-info → britekit-0.0.11.dist-info}/METADATA +2 -2
  38. {britekit-0.0.9.dist-info → britekit-0.0.11.dist-info}/RECORD +41 -41
  39. {britekit-0.0.9.dist-info → britekit-0.0.11.dist-info}/WHEEL +0 -0
  40. {britekit-0.0.9.dist-info → britekit-0.0.11.dist-info}/entry_points.txt +0 -0
  41. {britekit-0.0.9.dist-info → britekit-0.0.11.dist-info}/licenses/LICENSE.txt +0 -0
britekit/__about__.py CHANGED
@@ -1,4 +1,4 @@
1
1
  # SPDX-FileCopyrightText: 2025-present Jan Huus <jhuus1@gmail.com>
2
2
  #
3
3
  # SPDX-License-Identifier: MIT
4
- __version__ = "0.0.9"
4
+ __version__ = "0.0.11"
@@ -47,7 +47,7 @@ def analyze(
47
47
  from britekit.core.analyzer import Analyzer
48
48
 
49
49
  util.set_logging()
50
- cfg, _ = get_config(cfg_path)
50
+ cfg = get_config(cfg_path)
51
51
  try:
52
52
  if rtype not in {"audacity", "csv", "both"}:
53
53
  logging.error(f"Error. invalid rtype value: {rtype}")
@@ -142,7 +142,7 @@ def ckpt_onnx(
142
142
  import torch
143
143
  from britekit.models.model_loader import load_from_checkpoint
144
144
 
145
- cfg, _ = get_config(cfg_path)
145
+ cfg = get_config(cfg_path)
146
146
  base, _ = os.path.splitext(input_path)
147
147
  output_path = base + ".onnx"
148
148
  model = load_from_checkpoint(input_path)
@@ -23,7 +23,7 @@ def add_cat(db_path: Optional[str]=None, name: str="") -> None:
23
23
  """
24
24
  from britekit.training_db.training_db import TrainingDatabase
25
25
 
26
- cfg, _ = get_config()
26
+ cfg = get_config()
27
27
  if db_path is None:
28
28
  db_path = cfg.train.train_db
29
29
 
@@ -63,7 +63,7 @@ def add_stype(db_path: Optional[str]=None, name: str="") -> None:
63
63
  """
64
64
  from britekit.training_db.training_db import TrainingDatabase
65
65
 
66
- cfg, _ = get_config()
66
+ cfg = get_config()
67
67
  if db_path is None:
68
68
  db_path = cfg.train.train_db
69
69
 
@@ -103,7 +103,7 @@ def add_src(db_path: Optional[str]=None, name: str="") -> None:
103
103
  """
104
104
  from britekit.training_db.training_db import TrainingDatabase
105
105
 
106
- cfg, _ = get_config()
106
+ cfg = get_config()
107
107
  if db_path is None:
108
108
  db_path = cfg.train.train_db
109
109
 
@@ -154,7 +154,7 @@ def add_class(
154
154
  """
155
155
  from britekit.training_db.training_db import TrainingDatabase
156
156
 
157
- cfg, _ = get_config()
157
+ cfg = get_config()
158
158
  if db_path is None:
159
159
  db_path = cfg.train.train_db
160
160
 
@@ -25,7 +25,7 @@ def del_cat(db_path: Optional[str]=None, name: Optional[str]=None) -> None:
25
25
  """
26
26
  from britekit.training_db.training_db import TrainingDatabase
27
27
 
28
- cfg, _ = get_config()
28
+ cfg = get_config()
29
29
  if db_path is None:
30
30
  db_path = cfg.train.train_db
31
31
 
@@ -78,7 +78,7 @@ def del_class(db_path: Optional[str]=None, name: Optional[str]=None) -> None:
78
78
  """
79
79
  from britekit.training_db.training_db import TrainingDatabase
80
80
 
81
- cfg, _ = get_config()
81
+ cfg = get_config()
82
82
  if db_path is None:
83
83
  db_path = cfg.train.train_db
84
84
 
@@ -128,7 +128,7 @@ def del_rec(db_path: Optional[str]=None, file_name: Optional[str]=None) -> None:
128
128
  """
129
129
  from britekit.training_db.training_db import TrainingDatabase
130
130
 
131
- cfg, _ = get_config()
131
+ cfg = get_config()
132
132
  if db_path is None:
133
133
  db_path = cfg.train.train_db
134
134
 
@@ -172,7 +172,7 @@ def del_sgroup(db_path: Optional[str]=None, name: Optional[str]=None) -> None:
172
172
  """
173
173
  from britekit.training_db.training_db import TrainingDatabase
174
174
 
175
- cfg, _ = get_config()
175
+ cfg = get_config()
176
176
  if db_path is None:
177
177
  db_path = cfg.train.train_db
178
178
 
@@ -217,7 +217,7 @@ def del_stype(db_path: Optional[str]=None, name: Optional[str]=None) -> None:
217
217
  """
218
218
  from britekit.training_db.training_db import TrainingDatabase
219
219
 
220
- cfg, _ = get_config()
220
+ cfg = get_config()
221
221
  if db_path is None:
222
222
  db_path = cfg.train.train_db
223
223
 
@@ -262,7 +262,7 @@ def del_src(db_path: Optional[str]=None, name: Optional[str]=None) -> None:
262
262
  """
263
263
  from britekit.training_db.training_db import TrainingDatabase
264
264
 
265
- cfg, _ = get_config()
265
+ cfg = get_config()
266
266
  if db_path is None:
267
267
  db_path = cfg.train.train_db
268
268
 
@@ -311,7 +311,7 @@ def del_seg(db_path: Optional[str]=None, class_name: Optional[str]=None, dir_pat
311
311
  """
312
312
  from britekit.training_db.training_db import TrainingDatabase
313
313
 
314
- cfg, _ = get_config()
314
+ cfg = get_config()
315
315
  if db_path is None:
316
316
  db_path = cfg.train.train_db
317
317
 
@@ -57,7 +57,7 @@ def embed(
57
57
  from britekit.models.model_loader import load_from_checkpoint
58
58
  from britekit.training_db.training_db import TrainingDatabase
59
59
 
60
- cfg, _ = get_config(cfg_path)
60
+ cfg = get_config(cfg_path)
61
61
  if db_path is None:
62
62
  db_path = cfg.train.train_db
63
63
 
@@ -68,7 +68,6 @@ def ensemble(
68
68
  metric: str = "micro_roc",
69
69
  annotations_path: str = "",
70
70
  recordings_path: Optional[str] = None,
71
- output_path: str = "",
72
71
  ) -> None:
73
72
  """
74
73
  Find the best ensemble of a given size from a group of checkpoints.
@@ -84,7 +83,6 @@ def ensemble(
84
83
  metric (str): Metric to use to compare ensembles (default=micro_roc).
85
84
  annotations_path (str): Path to CSV file containing ground truth annotations.
86
85
  recordings_path (str, optional): Directory containing audio recordings. Defaults to annotations directory.
87
- output_path (str): Directory where reports will be saved.
88
86
  """
89
87
  import glob
90
88
  import itertools
@@ -95,7 +93,7 @@ def ensemble(
95
93
  logging.error(f"Error: invalid metric ({metric})")
96
94
  return
97
95
 
98
- cfg, _ = get_config(cfg_path)
96
+ cfg = get_config(cfg_path)
99
97
  ckpt_paths = sorted(glob.glob(os.path.join(ckpt_path, "*.ckpt")))
100
98
  num_ckpts = len(ckpt_paths)
101
99
  if num_ckpts == 0:
@@ -145,6 +143,7 @@ def ensemble(
145
143
 
146
144
  logging.info(f"Best score = {best_score:.4f}")
147
145
 
146
+ assert best_ensemble is not None
148
147
  best_names = [Path(ckpt_path).name for ckpt_path in best_ensemble]
149
148
  logging.info(f"Best ensemble = {best_names}")
150
149
 
@@ -215,14 +214,6 @@ def ensemble(
215
214
  required=False,
216
215
  help="Recordings directory. Default is directory containing annotations file.",
217
216
  )
218
- @click.option(
219
- "-o",
220
- "--output",
221
- "output_path",
222
- type=click.Path(file_okay=False, dir_okay=True),
223
- required=True,
224
- help="Path to output directory.",
225
- )
226
217
  def _ensemble_cmd(
227
218
  cfg_path: Optional[str],
228
219
  ckpt_path: str,
@@ -231,7 +222,6 @@ def _ensemble_cmd(
231
222
  metric: str,
232
223
  annotations_path: str,
233
224
  recordings_path: Optional[str],
234
- output_path: str,
235
225
  ) -> None:
236
226
  util.set_logging()
237
- ensemble(cfg_path, ckpt_path, ensemble_size, num_tries, metric, annotations_path, recordings_path, output_path)
227
+ ensemble(cfg_path, ckpt_path, ensemble_size, num_tries, metric, annotations_path, recordings_path)
@@ -42,7 +42,7 @@ def extract_all(
42
42
  from britekit.training_db.extractor import Extractor
43
43
  from britekit.training_db.training_db import TrainingDatabase
44
44
 
45
- cfg, _ = get_config(cfg_path)
45
+ cfg = get_config(cfg_path)
46
46
  if db_path is not None:
47
47
  cfg.train.train_db = db_path
48
48
 
@@ -172,7 +172,7 @@ def extract_by_image(
172
172
  from britekit.training_db.extractor import Extractor
173
173
  from britekit.training_db.training_db import TrainingDatabase
174
174
 
175
- cfg, _ = get_config(cfg_path)
175
+ cfg = get_config(cfg_path)
176
176
  if db_path is not None:
177
177
  cfg.train.train_db = db_path
178
178
 
@@ -105,7 +105,7 @@ def find_dup(
105
105
  else:
106
106
  return False
107
107
 
108
- cfg, _ = get_config(cfg_path)
108
+ cfg = get_config(cfg_path)
109
109
  if db_path is None:
110
110
  db_path = cfg.train.train_db
111
111
 
@@ -37,7 +37,7 @@ def pickle(
37
37
  """
38
38
  from britekit.core.pickler import Pickler
39
39
 
40
- cfg, _ = get_config(cfg_path)
40
+ cfg = get_config(cfg_path)
41
41
  if db_path is None:
42
42
  db_path = cfg.train.train_db
43
43
 
@@ -89,7 +89,7 @@ def plot_db(
89
89
  from britekit.core.plot import plot_spec
90
90
  from britekit.training_db.training_db import TrainingDatabase
91
91
 
92
- cfg, _ = get_config(cfg_path)
92
+ cfg = get_config(cfg_path)
93
93
  if power is not None:
94
94
  cfg.audio.power = power
95
95
 
@@ -247,7 +247,7 @@ def plot_dir(
247
247
  """
248
248
  from britekit.core.audio import Audio
249
249
 
250
- cfg, _ = get_config(cfg_path)
250
+ cfg = get_config(cfg_path)
251
251
  if power is not None:
252
252
  cfg.audio.power = power
253
253
 
@@ -363,7 +363,7 @@ def plot_rec(
363
363
  """
364
364
  from britekit.core.audio import Audio
365
365
 
366
- cfg, _ = get_config(cfg_path)
366
+ cfg = get_config(cfg_path)
367
367
  if power is not None:
368
368
  cfg.audio.power = power
369
369
 
@@ -38,7 +38,7 @@ def reextract(
38
38
  spec_group (str): Spectrogram group name for storing the extracted spectrograms. Defaults to 'default'.
39
39
  """
40
40
  from britekit.core.reextractor import Reextractor
41
- cfg, _ = get_config(cfg_path)
41
+ cfg = get_config(cfg_path)
42
42
 
43
43
  if class_name and classes_path:
44
44
  logging.error("Only one of --name and --classes may be specified.")
@@ -143,7 +143,7 @@ def rpt_db(cfg_path: Optional[str] = None,
143
143
  from britekit.training_db.training_db import TrainingDatabase
144
144
  from britekit.training_db.training_data_provider import TrainingDataProvider
145
145
 
146
- cfg, _ = get_config(cfg_path)
146
+ cfg = get_config(cfg_path)
147
147
  if db_path is not None:
148
148
  cfg.train.train_db = db_path
149
149
 
@@ -214,7 +214,7 @@ def rpt_epochs(
214
214
  from britekit.core.analyzer import Analyzer
215
215
  from britekit.testing.per_segment_tester import PerSegmentTester
216
216
 
217
- cfg, _ = get_config(cfg_path)
217
+ cfg = get_config(cfg_path)
218
218
  ckpt_paths = glob.glob(str(Path(input_path) / "*.ckpt"))
219
219
  if len(ckpt_paths) == 0:
220
220
  logging.error(f"No checkpoint files found in {input_path}")
@@ -403,7 +403,7 @@ def rpt_labels(
403
403
  """
404
404
  import pandas as pd
405
405
 
406
- cfg, _ = get_config()
406
+ cfg = get_config()
407
407
  if min_score is None:
408
408
  min_score = cfg.infer.min_score
409
409
 
@@ -556,7 +556,7 @@ def rpt_test(
556
556
  from britekit.testing.per_recording_tester import PerRecordingTester
557
557
  from britekit.testing.per_segment_tester import PerSegmentTester
558
558
 
559
- cfg, _ = get_config()
559
+ cfg = get_config()
560
560
  try:
561
561
  if not recordings_path:
562
562
  recordings_path = str(Path(annotations_path).parent)
@@ -62,7 +62,7 @@ def search(
62
62
  from britekit.models.model_loader import load_from_checkpoint
63
63
  from britekit.training_db.training_db import TrainingDatabase
64
64
 
65
- cfg, _ = get_config(cfg_path)
65
+ cfg = get_config(cfg_path)
66
66
 
67
67
  if not os.path.exists(output_path):
68
68
  os.makedirs(output_path)
@@ -31,7 +31,7 @@ def train(
31
31
  """
32
32
  from britekit.core.trainer import Trainer
33
33
 
34
- cfg, _ = get_config(cfg_path)
34
+ cfg = get_config(cfg_path)
35
35
  try:
36
36
  start_time = time.time()
37
37
  Trainer().run()
@@ -89,7 +89,7 @@ def find_lr(cfg_path: str, num_batches: int):
89
89
  """
90
90
  from britekit.core.trainer import Trainer
91
91
 
92
- cfg, _ = get_config(cfg_path)
92
+ cfg = get_config(cfg_path)
93
93
  try:
94
94
  suggested_lr, fig = Trainer().find_lr(num_batches)
95
95
  fig.savefig("learning_rates.jpeg")
@@ -58,7 +58,7 @@ def tune(
58
58
  from britekit.core.tuner import Tuner
59
59
 
60
60
  try:
61
- cfg, _ = get_config(cfg_path)
61
+ cfg = get_config(cfg_path)
62
62
  if extract and skip_training:
63
63
  logging.error(
64
64
  "Performing spectrogram extract is incompatible with skipping training."
@@ -104,6 +104,10 @@ def tune(
104
104
  to_path = os.path.join(output_path, Path(cfg_path).name)
105
105
  shutil.copy(cfg_path, to_path)
106
106
 
107
+ if param_path:
108
+ to_path = os.path.join(output_path, Path(param_path).name)
109
+ shutil.copy(param_path, to_path)
110
+
107
111
  elapsed_time = util.format_elapsed_time(start_time, time.time())
108
112
  logging.info(f"Elapsed time = {elapsed_time}")
109
113
 
britekit/core/analyzer.py CHANGED
@@ -16,7 +16,7 @@ class Analyzer:
16
16
  """
17
17
 
18
18
  def __init__(self):
19
- self.cfg, self.fn_cfg = get_config()
19
+ self.cfg = get_config()
20
20
  self.dataframes = []
21
21
 
22
22
  def _save_manifest(self, output_path: str, predictor):
britekit/core/audio.py CHANGED
@@ -51,7 +51,7 @@ class Audio:
51
51
  import torchaudio as ta
52
52
 
53
53
  if cfg is None:
54
- self.cfg, _ = get_config()
54
+ self.cfg = get_config()
55
55
  else:
56
56
  self.cfg = cfg
57
57
 
@@ -6,7 +6,7 @@ _base_config: Optional[BaseConfig] = None
6
6
  _func_config: Optional[FunctionConfig] = None
7
7
 
8
8
 
9
- def get_config(cfg_path: Optional[str] = None) -> tuple[BaseConfig, FunctionConfig]:
9
+ def get_config(cfg_path: Optional[str] = None) -> BaseConfig:
10
10
  from omegaconf import OmegaConf, DictConfig
11
11
 
12
12
  if cfg_path is None:
@@ -16,21 +16,27 @@ def get_config(cfg_path: Optional[str] = None) -> tuple[BaseConfig, FunctionConf
16
16
  return get_config_with_dict(yaml_cfg)
17
17
 
18
18
 
19
- def get_config_with_dict(
20
- cfg_dict=None,
21
- ) -> tuple[BaseConfig, FunctionConfig]:
19
+ def get_func_config() -> FunctionConfig:
20
+ global _func_config
21
+ if _func_config is None:
22
+ _func_config = FunctionConfig()
23
+
24
+ return _func_config
25
+
26
+
27
+ def get_config_with_dict(cfg_dict=None) -> BaseConfig:
22
28
  from omegaconf import OmegaConf
23
29
 
24
- global _base_config, _func_config
30
+ global _base_config
25
31
  if _base_config is None:
26
32
  _base_config = OmegaConf.structured(BaseConfig())
27
- _func_config = FunctionConfig()
33
+
28
34
  # allow late merges/overrides even if already initialized
29
35
  if cfg_dict is not None:
30
36
  _base_config = cast(
31
37
  BaseConfig, OmegaConf.merge(_base_config, OmegaConf.create(cfg_dict))
32
38
  )
33
- return cast(tuple[BaseConfig, FunctionConfig], (_base_config, _func_config))
39
+ return _base_config
34
40
 
35
41
 
36
42
  def set_base_config(cfg: BaseConfig) -> None:
@@ -13,7 +13,7 @@ class DataModule(LightningDataModule):
13
13
  super().__init__()
14
14
  from britekit.core.dataset import SpectrogramDataset
15
15
 
16
- self.cfg, _ = get_config()
16
+ self.cfg = get_config()
17
17
  self.train_data = None
18
18
  self.val_data = None
19
19
  self.test_data = None
britekit/core/dataset.py CHANGED
@@ -59,7 +59,7 @@ class SpectrogramDataset(Dataset):
59
59
  self.noise_class_index = noise_class_index
60
60
  self.is_training = is_training
61
61
 
62
- self.cfg, _ = get_config()
62
+ self.cfg = get_config()
63
63
 
64
64
  # get indexes of all specs that contain only noise
65
65
  self.noise_indexes = []
britekit/core/pickler.py CHANGED
@@ -30,7 +30,7 @@ class Pickler:
30
30
  ):
31
31
  from britekit.training_db.training_db import TrainingDatabase
32
32
 
33
- self.cfg, self.fn_cfg = get_config()
33
+ self.cfg = get_config()
34
34
  self.classes_path = classes_path
35
35
  self.output_path = output_path
36
36
  self.max_per_class = max_per_class
britekit/core/plot.py CHANGED
@@ -28,7 +28,7 @@ def plot_spec(
28
28
  import matplotlib.pyplot as plt
29
29
  import numpy as np
30
30
 
31
- cfg, _ = get_config()
31
+ cfg = get_config()
32
32
  assert cfg.audio.freq_scale in {"linear", "log", "mel"}
33
33
 
34
34
  if spec_duration is None:
@@ -37,7 +37,7 @@ class Predictor:
37
37
  """
38
38
  from britekit.core.audio import Audio
39
39
 
40
- self.cfg, _ = get_config()
40
+ self.cfg = get_config()
41
41
  self.audio = Audio()
42
42
  self.class_names: Optional[List[str]] = None
43
43
  self.class_codes: Optional[List[str]] = None
@@ -61,7 +61,7 @@ class Reextractor:
61
61
  import numpy as np
62
62
  import pandas as pd
63
63
 
64
- cfg, _ = get_config()
64
+ cfg = get_config()
65
65
 
66
66
  with TrainingDatabase(self.db_path) as db:
67
67
  if self.class_name is None and self.classes_path is None:
britekit/core/trainer.py CHANGED
@@ -14,7 +14,7 @@ class Trainer:
14
14
  import pytorch_lightning as pl
15
15
  import torch
16
16
 
17
- self.cfg, _ = get_config()
17
+ self.cfg = get_config()
18
18
  torch.set_float32_matmul_precision("medium")
19
19
  if self.cfg.train.seed is not None:
20
20
  pl.seed_everything(self.cfg.train.seed, workers=True)
britekit/core/tuner.py CHANGED
@@ -42,7 +42,7 @@ class Tuner:
42
42
  from britekit.core.pickler import Pickler
43
43
  from britekit.core.reextractor import Reextractor
44
44
 
45
- self.cfg, self.fn_cfg = get_config()
45
+ self.cfg = get_config()
46
46
  self.original_seed = self.cfg.train.seed
47
47
  self.recording_dir = recording_dir
48
48
  self.output_dir = output_dir
britekit/core/util.py CHANGED
@@ -101,7 +101,7 @@ def get_device() -> str:
101
101
  """Return the device for pytorch to use."""
102
102
  import torch
103
103
 
104
- cfg, _ = get_config()
104
+ cfg = get_config()
105
105
  if cfg.misc.force_cpu:
106
106
  return "cpu" # for performance comparisons
107
107
  elif torch.cuda.is_available():
@@ -362,7 +362,7 @@ def get_source_name(filename: str) -> str:
362
362
  if not filename:
363
363
  return "default"
364
364
 
365
- cfg, _ = get_config()
365
+ cfg = get_config()
366
366
  if not cfg.misc.source_regexes:
367
367
  return "default"
368
368
 
@@ -432,7 +432,7 @@ def expand_spectrogram(spec: bytes):
432
432
  raise TypeError("spec must be bytes")
433
433
 
434
434
  try:
435
- cfg, _ = get_config()
435
+ cfg = get_config()
436
436
  bytes_data = zlib.decompress(spec)
437
437
  spec_array = np.frombuffer(bytes_data, dtype=np.uint8) / 255
438
438
  spec_array = spec_array.astype(np.float32)
@@ -72,7 +72,7 @@ class BaseModel(pl.LightningModule):
72
72
  )
73
73
 
74
74
  self.save_hyperparameters()
75
- self.cfg, _ = get_config()
75
+ self.cfg = get_config()
76
76
 
77
77
  # Save parameters
78
78
  self.model_type = model_type
@@ -22,7 +22,7 @@ def load_new_model(
22
22
  from britekit.models.hgnet import HGNetModel
23
23
  from britekit.models.vovnet import VovNetModel
24
24
 
25
- cfg, _ = get_config()
25
+ cfg = get_config()
26
26
  device = get_device()
27
27
 
28
28
  # create a dict of optional keyword arguments
@@ -39,7 +39,7 @@ class TimmModel(BaseModel):
39
39
 
40
40
  # head replacement is not supported here since it
41
41
  # would be very complicated with so many model types
42
- cfg, _ = get_config()
42
+ cfg = get_config()
43
43
  assert model_type.startswith("timm.")
44
44
  self.backbone = timm.create_model(
45
45
  model_type[5:], # strip off the "timm." prefix
@@ -62,7 +62,7 @@ class PerMinuteTester(BaseTester):
62
62
  self.threshold = threshold
63
63
  self.gen_pr_table = gen_pr_table
64
64
 
65
- self.cfg, self.fn_cfg = get_config()
65
+ self.cfg = get_config()
66
66
 
67
67
  # ============================================================================
68
68
  # Public methods - Main execution
@@ -56,7 +56,7 @@ class PerRecordingTester(BaseTester):
56
56
  self.tp_secs_at_precision = tp_secs_at_precision
57
57
  self.per_recording = True
58
58
 
59
- self.cfg, self.fn_cfg = get_config()
59
+ self.cfg = get_config()
60
60
 
61
61
  # ============================================================================
62
62
  # Public methods - Main execution
@@ -68,7 +68,7 @@ class PerSegmentTester(BaseTester):
68
68
  self.coefficient = coef
69
69
  self.intercept = inter
70
70
 
71
- self.cfg, self.fn_cfg = get_config()
71
+ self.cfg = get_config()
72
72
 
73
73
  def _get_recording_info(self):
74
74
  """
@@ -43,7 +43,7 @@ class Extractor:
43
43
  self.spec_group = spec_group if spec_group is not None else "default"
44
44
 
45
45
  self.provider = TrainingDataProvider(self.db)
46
- self.cfg, _ = get_config()
46
+ self.cfg = get_config()
47
47
  self.audio = audio.Audio()
48
48
 
49
49
  if overlap is None:
@@ -6,7 +6,6 @@ from types import SimpleNamespace
6
6
  from typing import Optional
7
7
 
8
8
  from britekit.core.exceptions import DatabaseError
9
- from britekit.core.config_loader import get_config
10
9
 
11
10
 
12
11
  class TrainingDatabase:
@@ -20,7 +19,6 @@ class TrainingDatabase:
20
19
 
21
20
  def __init__(self, db_path: str = os.path.join("data", "training.db")):
22
21
  self.today = datetime.today().strftime("%Y-%m-%d")
23
- _, self.fn_cfg = get_config()
24
22
  try:
25
23
  self.conn = sqlite3.connect(db_path)
26
24
  self.conn.execute("PRAGMA foreign_keys = ON")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: britekit
3
- Version: 0.0.9
3
+ Version: 0.0.11
4
4
  Summary: Core functions for bioacoustic recognizers.
5
5
  Project-URL: Documentation, https://github.com/jhuus/BriteKit#readme
6
6
  Project-URL: Issues, https://github.com/jhuus/BriteKit/issues
@@ -120,7 +120,7 @@ train:
120
120
  This overrides the default values for model_type, learning_rate, drop_rate and num_epochs. When using the API, you can update configuration parameters like this:
121
121
  ```
122
122
  import britekit as bk
123
- cfg, _ = bk.get_config()
123
+ cfg = bk.get_config()
124
124
  cfg.train.model_type = "effnet.4"
125
125
  ```
126
126
  ## Downloading Recordings
@@ -1,38 +1,38 @@
1
1
  britekit/cli.py,sha256=nnrCMfw3-1GJ4rKFpqTLu8JcBGxTocMn7nwzU4OSaew,3080
2
- britekit/core/analyzer.py,sha256=4hctyNvM3mZ0FywEWKbPHamxzl1nZh1xdHkBxM4WPxo,5617
3
- britekit/core/audio.py,sha256=8QLbNDAiQyViEhrVC8jU0n32we4C22W_jPfc_KcOlmQ,15853
2
+ britekit/core/analyzer.py,sha256=0OYVxuwYx_R36MZwIlVgPMWQ1udZ_tdgYODJyEVDJm0,5604
3
+ britekit/core/audio.py,sha256=Ju1SBO9c8GUM0RZ-NuolZoPHF6hATLvayVEvKVOgxOw,15850
4
4
  britekit/core/augmentation.py,sha256=5_wyB-6gt7uM68Zl-rO_fPu1D6tlsd2m5oWhA6l0W9Q,5721
5
5
  britekit/core/base_config.py,sha256=wbCJI9cEH9mktUTSfLSCnU5AhJT6xhxhwZS4QWRYTpM,8744
6
- britekit/core/config_loader.py,sha256=epHNlH7yi_sCJX01FwgOsM6vPFk25rgUwkkcoGvVsYg,1341
7
- britekit/core/data_module.py,sha256=f6BL-ngqkklX06Q7xZ9PMKEkvfeCzQTLYdmXRg3RmCo,9108
8
- britekit/core/dataset.py,sha256=Xu-lTz3TsHMuW10lHg4NN_r1baS9OQEhAD7EVz1a3A4,5804
6
+ britekit/core/config_loader.py,sha256=mDmLwKYXsWb9FRk12q9Rj2rVdvbCVCI3QTdsZSnUBCY,1339
7
+ britekit/core/data_module.py,sha256=0DkOZTTGymZ7JjukucDuAq-nXS_KPhqV7KFPhmMoQDw,9105
8
+ britekit/core/dataset.py,sha256=R_NDaFljl4IMKxGWWWm1PMkYCcfrEaiJU1NrVswt6eM,5801
9
9
  britekit/core/exceptions.py,sha256=ti_ve7ZdhDmzgTuspXXqyw__SUt5NoAXGEwoe3agPU8,443
10
- britekit/core/pickler.py,sha256=Vj-_DdFQUQj2bIVoyWe5puI8g8dTP9x7ZavbvM1iQZo,5788
11
- britekit/core/plot.py,sha256=hLuLB1VdtdFyaSHVDGl5tjjFCRgOJJ1ucTVJHM_3D_0,5332
12
- britekit/core/predictor.py,sha256=u4H8horTTvcg4Oqfpy5PG44eiiMeR5RU3aPZnMiXRCw,22914
13
- britekit/core/reextractor.py,sha256=gazhIZN8V1K4T_Q_kc-ihxUYbkNnc_hoAS6bpYQc95I,8396
14
- britekit/core/trainer.py,sha256=tKyXZf5vm1yHJ8tyVvwgDOprAVZPKdiVEbLHlDJ8hKo,6440
15
- britekit/core/tuner.py,sha256=FMmy4p3_j2Tojs4ONPzuUeRpCPWGlttr4rUJac7Hkyk,16435
16
- britekit/core/util.py,sha256=0JsEEN09hFPQzuttCKaejWofXAjCGSvWEewjkiLAh3E,19172
17
- britekit/models/base_model.py,sha256=9T7TwHx3K8fl10Vb-qUuypK3NDDZM-ktB8ZLHzqQhdc,16883
10
+ britekit/core/pickler.py,sha256=72hiqOiIbBeXvHGwmHAOODr9wGdyBwj4NUYecxIhtCE,5775
11
+ britekit/core/plot.py,sha256=H-SB2ooe2LT0j1KoXs2PgT3t05oAB4CWkYX_HvGMO_c,5329
12
+ britekit/core/predictor.py,sha256=9Heue3ku9rw4OfE0SWuWLKBLW-aMw8PXqWlBB4GUCbw,22911
13
+ britekit/core/reextractor.py,sha256=UqWLapReNhEne0dykBCN_UIpLOHkZxJMw4RAlG70nzI,8393
14
+ britekit/core/trainer.py,sha256=vFIVyFCYhnV0zdRjNU93wzd7_HLtiaXW8mAiK7BoJPA,6437
15
+ britekit/core/tuner.py,sha256=LoQi7jwIwqv2DY7MgupG32PdD6QiuneQrgRgxq8ANlk,16422
16
+ britekit/core/util.py,sha256=JKT-yqFPA9FBMT1-YsGvNE8E21242MYAsXvRGSgTNYg,19163
17
+ britekit/models/base_model.py,sha256=VpY2aMb7P3QWGzhIdJRGxdjT6z-o7XE5sJxnupeZtxQ,16880
18
18
  britekit/models/dla.py,sha256=ALMY997AbERN7-sHqQuE5e43llRjpUDPZSFGL-Flv4M,3137
19
19
  britekit/models/effnet.py,sha256=e7WdZMsLPXe8jcWChk6n97c8DMV0YyGV6lDP_Jv6Wz4,3129
20
20
  britekit/models/gernet.py,sha256=7MEUZaDTfr-6oa8eE8dyDQb2LgahGBOEp1pTZSu1KOE,7022
21
21
  britekit/models/head_factory.py,sha256=9X91_ZjY2GtfxSlCpo7RN6VCuWfqInPXDdv5qV9jv1Y,11268
22
22
  britekit/models/hgnet.py,sha256=sgnNMpn98QI7JrytqOUzbAxngk_AIp5gKvsmu31hOzE,7125
23
- britekit/models/model_loader.py,sha256=WEUuZAG5sxejJm8OWyr6SC8N7eWDgXjfUqhA4oIwf4E,4365
24
- britekit/models/timm_model.py,sha256=PlQ74TLJQV4ni7Qya5-EDaR7jrGcr2ETHOtlM0FrxIY,1468
23
+ britekit/models/model_loader.py,sha256=wws7sWBXskcjsxEsohXz2ZdBa-DdNNp39fu9WMqz2Hc,4362
24
+ britekit/models/timm_model.py,sha256=enGaxF-hV69Y3sn7axp8hYyL2GW2OMWwjk9gWzrGEAI,1465
25
25
  britekit/models/vovnet.py,sha256=s8z5QaGO6zPNSN0e0CrgAPYd5qLxC7FNvxe4w7ZmkM4,5504
26
26
  britekit/occurrence_db/occurrence_data_provider.py,sha256=1YR4Ubk1KPqLaTGp9Y8_VM-CQth1Am7X-hEl0I4ocT4,5967
27
27
  britekit/occurrence_db/occurrence_db.py,sha256=-726UfhjppeIpDQ96VPtC675suk-7yR4Vgq3qMwFurM,11219
28
28
  britekit/testing/base_tester.py,sha256=AHogaBK7wOICqtWUr6reuJK6IpV5F0HOXI2aBovXWIY,46182
29
- britekit/testing/per_minute_tester.py,sha256=J-ghWeoRuhq86olwvFtqYytDu9M_3SunPxkKgcrDDOs,31566
30
- britekit/testing/per_recording_tester.py,sha256=Gyfi0XvJ84Fd5jSyZM7emQP0U0a2eezdzpiZk5osd9Y,21739
31
- britekit/testing/per_segment_tester.py,sha256=FnaozQ8VmH99aYc1ibmDFfOk_ADgsXQGU_l6hMaXyco,37079
32
- britekit/training_db/extractor.py,sha256=pT7lAUsNzYs3RXDzpMv7q0MKg6TktiFLKrRtKTWv6ho,8409
29
+ britekit/testing/per_minute_tester.py,sha256=wLIRatNCMhoylzYzXXFAikj_c9sy54O6SW4Wie8XSBQ,31553
30
+ britekit/testing/per_recording_tester.py,sha256=7Qzb3kyMDDXc1n9MACbht1xkgeZgDlU-eQX4Jw8I7bY,21726
31
+ britekit/testing/per_segment_tester.py,sha256=5zFpe8wVEEtVjthKKFRb0dwE9T0v4JIll9Tto4KDYbo,37066
32
+ britekit/training_db/extractor.py,sha256=yblYTco9b-bZhBTOkGkNANOabsNo8IfQGJxPvh_eJyo,8406
33
33
  britekit/training_db/training_data_provider.py,sha256=V5aBjsCvrWViZ0Jv05hgcKRizcAXmqoj4q3hAHedoD8,5651
34
- britekit/training_db/training_db.py,sha256=OOfD1pcbq5HVJbzhmuI-D-gkPHWSoz0cCO4zIUGFvoY,65011
35
- britekit/__about__.py,sha256=QXWLwMXjHd1KWRO6vKHNgPREhZNrZv3ac2FWBvQPN6E,122
34
+ britekit/training_db/training_db.py,sha256=xZqN1sMC2yFMEDm9rOrCigN3CUfUzTaTUkX3IZ_zHRc,64922
35
+ britekit/__about__.py,sha256=CGewA3qxQM5QGFXz6GxYj1rsR4YlBI3pPly5AWErQFI,123
36
36
  britekit/__init__.py,sha256=RpruzdjbvTcFNf21zJYY8HrAhJei91FtNNLjIBmw-kw,1857
37
37
  britekit/install/data/classes.csv,sha256=OdTZ8oQdx7N-HKyhftxZStGZYsjhCy4UbanwtQJ2wBM,54
38
38
  britekit/install/data/ignore.txt,sha256=RbKvEHtUCbgRYolwR1IucClwyD3q7l2s6QuRjph-Us4,68
@@ -65,31 +65,31 @@ britekit/install/yaml/samples/tune_learning_rate.yaml,sha256=UTtpsJwO33UWW0oecGR
65
65
  britekit/install/yaml/samples/tune_optimizer.yaml,sha256=VtGlZmMJ22gaZWJ7CPLNHRZ-8EHeB5GmxywQm1Iy1MM,73
66
66
  britekit/install/yaml/samples/tune_smooth.yaml,sha256=IZq2lohiJWVdzPl-i3aCEwEsJLmG_bg7EvyBUSI-R0o,83
67
67
  britekit/commands/__init__.py,sha256=mms49ChyrGj4zzeUge6bl7uiPhOMjFm37NTk23ZFmXw,1586
68
- britekit/commands/_analyze.py,sha256=Hss0ubLjGM2FSbQk52S9wvfj73-gkym4uW_o8Td-BOc,4954
68
+ britekit/commands/_analyze.py,sha256=os2Td8bHN-JlLt7AFw4tfJD7g_yQQ7K8eSaCUfyxKs8,4951
69
69
  britekit/commands/_audioset.py,sha256=BqmAJq6yWpyqBYIUWt9d0khBTQRa3vgUMdCS4U0fxvA,9957
70
70
  britekit/commands/_calibrate.py,sha256=338dRyGRj-Bw_4wFxiANDCbo-lZgdl0OR2gD8PmLv8U,4912
71
- britekit/commands/_ckpt_ops.py,sha256=gutU8wqzrJCIyyuo_kLtIaOm9tq6h7q1Xm9L2QNU56c,5781
72
- britekit/commands/_db_add.py,sha256=LQD3nR_d8oI19YNi06EzE62kS5DlbvL-q2HZSRmEGeE,7261
73
- britekit/commands/_db_delete.py,sha256=rCV2tL8x-sNgsYmHZc6Id7_4-iLynwkK2f2_KRFkAZo,14541
74
- britekit/commands/_embed.py,sha256=MlP1HMRBmOANWEdbW1qhpnFGaxMUyeGEYOqaXV6K_cg,4391
75
- britekit/commands/_ensemble.py,sha256=UElN1aajykpktekfA4bKPHh0VB1NYwJtaEjn91xRF2c,7849
76
- britekit/commands/_extract.py,sha256=7c_XnJY42IQ2AA70JmgFU9IkIUodkDoLy2vfYWU99AE,8865
77
- britekit/commands/_find_dup.py,sha256=yPn2EqG0icYHgUN8_87KuY9uOqEwDxqvhJc-DfBD40w,6353
71
+ britekit/commands/_ckpt_ops.py,sha256=2l-eJuxGBTHtQZ2Nked82KeSbP7WIwZ-yAYuM4v4HlU,5778
72
+ britekit/commands/_db_add.py,sha256=brUCb7LZVJ7XezlSmpaKilz9hYoII_DvfjhS1v64cr0,7249
73
+ britekit/commands/_db_delete.py,sha256=ziqxnQhBOjHgqlu0uk6GA8A7I9FOMYcPEscmPxThAVY,14520
74
+ britekit/commands/_embed.py,sha256=gTQK4YOilwsZCY2r8HhaWUZBpMkA-OEZsR5RkNV1euM,4388
75
+ britekit/commands/_ensemble.py,sha256=O6_BDgHWXdlCn_JdbZdI8X5NdGlnjJiz6nuJfVYkE0g,7583
76
+ britekit/commands/_extract.py,sha256=iz9VG1KnV-d7cFliQpmWiSi6Ezt9hCm5Iur9r-XBb20,8859
77
+ britekit/commands/_find_dup.py,sha256=Zig-s04BUQzeY4s7DjEQM53-e6KgCXxSw05R6BfSkNw,6350
78
78
  britekit/commands/_inat.py,sha256=ojTre5BCj_jmEh6x2kzNhcminLN6h5bzsYpxyrxGRdQ,4164
79
79
  britekit/commands/_init.py,sha256=FmaQRY-7SYSHCLXL__47LEPecWir7X6zEB05KpradFw,2829
80
- britekit/commands/_pickle.py,sha256=p990FsJGfSXcgjtBzH7nPGPh023b8cH0D7RZywQQ5Aw,3488
81
- britekit/commands/_plot.py,sha256=7vZXsYP9dv4PbHb8K3YbJFZc65YoPIBjEMBolyh6Has,13084
82
- britekit/commands/_reextract.py,sha256=kCmSjeghg6mhrJ46ibRTmBkGVytU7flFvTbqsnYhBvY,3770
83
- britekit/commands/_reports.py,sha256=qnUEWUgEB3BFzshBAQ9nz75Mvjpl2bEZCBy5ttNx7l4,22039
84
- britekit/commands/_search.py,sha256=HIUXwfPvh3rxpgaFSR3bAAI38OtGVPyMo5GMfLtLX-8,9991
85
- britekit/commands/_train.py,sha256=vGFKlfcv35cOelArQNbVbTRbDWogT_IMg0wZt5virHY,4158
86
- britekit/commands/_tune.py,sha256=g9GnlOSJpa-ZfNAw2iCMzw0qPgLFTGdTUjzw8Ghjfvc,7331
80
+ britekit/commands/_pickle.py,sha256=5ZlAHlyR5Hdb4SOnJ-9qBaSZkSvi98fgkIV13KN5jSU,3485
81
+ britekit/commands/_plot.py,sha256=Jhzeo7_FJxBfJWPNVZaLn9QA8w9O3nMO1HtA0C3M48Q,13075
82
+ britekit/commands/_reextract.py,sha256=zth_E3IyBlrJ-ovHxzpyZntbamEDwelBZ3QrzozFwkA,3767
83
+ britekit/commands/_reports.py,sha256=Xxj9Au-v6I9X0jnKye6GaLggasXz5XhVVEG5bLfNQSg,22027
84
+ britekit/commands/_search.py,sha256=b7cIFSI3AuPhreYGO8HGqX12TKaOJ5uoc1uiqid04Mk,9988
85
+ britekit/commands/_train.py,sha256=40Zdu9FZkmdA0bIuTK-oADw-4X6aMQYS1XGigheocdo,4152
86
+ britekit/commands/_tune.py,sha256=CFEY08SsPF_2s_fknUHJLEsho6vL_it8NoOhB2RoVU0,7468
87
87
  britekit/commands/_wav2mp3.py,sha256=2Q4cjT6OhJmBPTNzGRMrDd6dSdBBufuQdjhH1V8ghLo,2167
88
88
  britekit/commands/_xeno.py,sha256=_6YxQ7xFdaSy5DNUaigkbYp3E8EhtOhTC9b6OFS0MFA,6026
89
89
  britekit/commands/_youtube.py,sha256=_u1LrwY_2GxllKd505N_2ArFMbACQ_PtVxuqUCYxFe0,2214
90
90
  britekit/core/__init__.py,sha256=QcjcFyvO5KqJLF_HBeqiCk925uU5jTUjIV5lJix9XY4,556
91
- britekit-0.0.9.dist-info/METADATA,sha256=XFCWiF08LtF--mnG5gfLK0T7DeypGxF0oH4-s_T8u2g,18555
92
- britekit-0.0.9.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
93
- britekit-0.0.9.dist-info/entry_points.txt,sha256=ycnPy5DLX14RTf7lKfkQAVyIf1B1zTL1gMsHm455wmg,46
94
- britekit-0.0.9.dist-info/licenses/LICENSE.txt,sha256=kPoHm6iop8-CUa_720Tt8gqyvLD6D_7218u1hCCpErk,1092
95
- britekit-0.0.9.dist-info/RECORD,,
91
+ britekit-0.0.11.dist-info/METADATA,sha256=d1VgnfrMq3-tnSABq7aXN8SAMsuZI5ifbPM9MB7yDtE,18553
92
+ britekit-0.0.11.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
93
+ britekit-0.0.11.dist-info/entry_points.txt,sha256=ycnPy5DLX14RTf7lKfkQAVyIf1B1zTL1gMsHm455wmg,46
94
+ britekit-0.0.11.dist-info/licenses/LICENSE.txt,sha256=kPoHm6iop8-CUa_720Tt8gqyvLD6D_7218u1hCCpErk,1092
95
+ britekit-0.0.11.dist-info/RECORD,,