mirror of
https://github.com/macaodha/batdetect2.git
synced 2026-01-09 16:59:33 +01:00
Change default train duration to 0.256 instead of 0.512
This commit is contained in:
parent
93e89ecc46
commit
1cec332dd5
@ -10,7 +10,7 @@ from batdetect2.typing.preprocess import PreprocessorProtocol
|
||||
from batdetect2.typing.train import PreprocessedExample
|
||||
from batdetect2.utils.arrays import adjust_width, slice_tensor
|
||||
|
||||
DEFAULT_TRAIN_CLIP_DURATION = 0.512
|
||||
DEFAULT_TRAIN_CLIP_DURATION = 0.256
|
||||
DEFAULT_MAX_EMPTY_CLIP = 0.1
|
||||
|
||||
|
||||
|
||||
@ -22,6 +22,7 @@ from batdetect2.targets import (
|
||||
from batdetect2.targets.classes import ClassesConfig, TargetClass
|
||||
from batdetect2.targets.filtering import FilterConfig, FilterRule
|
||||
from batdetect2.targets.terms import TagInfo
|
||||
from batdetect2.train.clips import build_clipper
|
||||
from batdetect2.train.labels import build_clip_labeler
|
||||
from batdetect2.typing import (
|
||||
ClipLabeller,
|
||||
@ -29,6 +30,7 @@ from batdetect2.typing import (
|
||||
TargetProtocol,
|
||||
)
|
||||
from batdetect2.typing.preprocess import AudioLoader
|
||||
from batdetect2.typing.train import ClipperProtocol
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
@ -440,6 +442,13 @@ def sample_labeller(
|
||||
)
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def sample_clipper(
|
||||
sample_preprocessor: PreprocessorProtocol,
|
||||
) -> ClipperProtocol:
|
||||
return build_clipper(preprocessor=sample_preprocessor)
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def example_dataset(example_data_dir: Path) -> DatasetConfig:
|
||||
return DatasetConfig(
|
||||
|
||||
@ -1,3 +1,27 @@
|
||||
import numpy as np
|
||||
from soundevent import data
|
||||
|
||||
from batdetect2.train.clips import select_subclip
|
||||
from batdetect2.train import generate_train_example
|
||||
from batdetect2.typing import (
|
||||
AudioLoader,
|
||||
ClipLabeller,
|
||||
ClipperProtocol,
|
||||
PreprocessorProtocol,
|
||||
)
|
||||
|
||||
|
||||
def test_default_clip_size_is_correct(
|
||||
sample_clipper: ClipperProtocol,
|
||||
sample_labeller: ClipLabeller,
|
||||
sample_audio_loader: AudioLoader,
|
||||
clip_annotation: data.ClipAnnotation,
|
||||
sample_preprocessor: PreprocessorProtocol,
|
||||
):
|
||||
example = generate_train_example(
|
||||
clip_annotation=clip_annotation,
|
||||
audio_loader=sample_audio_loader,
|
||||
preprocessor=sample_preprocessor,
|
||||
labeller=sample_labeller,
|
||||
)
|
||||
|
||||
clip, _, _ = sample_clipper(example)
|
||||
assert clip.spectrogram.shape == (1, 128, 256)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user