mirror of
https://github.com/macaodha/batdetect2.git
synced 2026-01-10 00:59:34 +01:00
Add targets to data summary command
This commit is contained in:
parent
110432bd40
commit
efc996a0db
@ -22,6 +22,11 @@ def data(): ...
|
||||
type=str,
|
||||
help="If the dataset info is in a nested field please specify here.",
|
||||
)
|
||||
@click.option(
|
||||
"--targets",
|
||||
"targets_path",
|
||||
type=click.Path(exists=True),
|
||||
)
|
||||
@click.option(
|
||||
"--base-dir",
|
||||
type=click.Path(exists=True),
|
||||
@ -30,9 +35,11 @@ def data(): ...
|
||||
def summary(
|
||||
dataset_config: Path,
|
||||
field: Optional[str] = None,
|
||||
targets_path: Optional[Path] = None,
|
||||
base_dir: Optional[Path] = None,
|
||||
):
|
||||
from batdetect2.data import load_dataset_from_config
|
||||
from batdetect2.data import compute_class_summary, load_dataset_from_config
|
||||
from batdetect2.targets import load_targets
|
||||
|
||||
base_dir = base_dir or Path.cwd()
|
||||
|
||||
@ -44,6 +51,15 @@ def summary(
|
||||
|
||||
print(f"Number of annotated clips: {len(dataset)}")
|
||||
|
||||
if targets_path is None:
|
||||
return
|
||||
|
||||
targets = load_targets(targets_path)
|
||||
|
||||
summary = compute_class_summary(dataset, targets)
|
||||
|
||||
print(summary.to_markdown())
|
||||
|
||||
|
||||
@data.command()
|
||||
@click.argument(
|
||||
@ -78,15 +94,9 @@ def convert(
|
||||
|
||||
base_dir = base_dir or Path.cwd()
|
||||
|
||||
config = load_dataset_config(
|
||||
dataset_config,
|
||||
field=field,
|
||||
)
|
||||
config = load_dataset_config(dataset_config, field=field)
|
||||
|
||||
dataset = load_dataset(
|
||||
config,
|
||||
base_dir=base_dir,
|
||||
)
|
||||
dataset = load_dataset(config, base_dir=base_dir)
|
||||
|
||||
annotation_set = data.AnnotationSet(
|
||||
clip_annotations=list(dataset),
|
||||
|
||||
Loading…
Reference in New Issue
Block a user