singlebehaviorlab 2.1.0__tar.gz → 2.2.0__tar.gz
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.
- {singlebehaviorlab-2.1.0/singlebehaviorlab.egg-info → singlebehaviorlab-2.2.0}/PKG-INFO +3 -1
- {singlebehaviorlab-2.1.0 → singlebehaviorlab-2.2.0}/README.md +2 -0
- {singlebehaviorlab-2.1.0 → singlebehaviorlab-2.2.0}/pyproject.toml +1 -1
- {singlebehaviorlab-2.1.0 → singlebehaviorlab-2.2.0}/singlebehaviorlab/__init__.py +3 -1
- singlebehaviorlab-2.2.0/singlebehaviorlab/demo.py +131 -0
- {singlebehaviorlab-2.1.0 → singlebehaviorlab-2.2.0/singlebehaviorlab.egg-info}/PKG-INFO +3 -1
- {singlebehaviorlab-2.1.0 → singlebehaviorlab-2.2.0}/singlebehaviorlab.egg-info/SOURCES.txt +1 -0
- {singlebehaviorlab-2.1.0 → singlebehaviorlab-2.2.0}/LICENSE +0 -0
- {singlebehaviorlab-2.1.0 → singlebehaviorlab-2.2.0}/setup.cfg +0 -0
- {singlebehaviorlab-2.1.0 → singlebehaviorlab-2.2.0}/singlebehaviorlab/__main__.py +0 -0
- {singlebehaviorlab-2.1.0 → singlebehaviorlab-2.2.0}/singlebehaviorlab/_paths.py +0 -0
- {singlebehaviorlab-2.1.0 → singlebehaviorlab-2.2.0}/singlebehaviorlab/backend/__init__.py +0 -0
- {singlebehaviorlab-2.1.0 → singlebehaviorlab-2.2.0}/singlebehaviorlab/backend/augmentations.py +0 -0
- {singlebehaviorlab-2.1.0 → singlebehaviorlab-2.2.0}/singlebehaviorlab/backend/clustering.py +0 -0
- {singlebehaviorlab-2.1.0 → singlebehaviorlab-2.2.0}/singlebehaviorlab/backend/data_store.py +0 -0
- {singlebehaviorlab-2.1.0 → singlebehaviorlab-2.2.0}/singlebehaviorlab/backend/inference.py +0 -0
- {singlebehaviorlab-2.1.0 → singlebehaviorlab-2.2.0}/singlebehaviorlab/backend/model.py +0 -0
- {singlebehaviorlab-2.1.0 → singlebehaviorlab-2.2.0}/singlebehaviorlab/backend/registration.py +0 -0
- {singlebehaviorlab-2.1.0 → singlebehaviorlab-2.2.0}/singlebehaviorlab/backend/segmentation.py +0 -0
- {singlebehaviorlab-2.1.0 → singlebehaviorlab-2.2.0}/singlebehaviorlab/backend/train.py +0 -0
- {singlebehaviorlab-2.1.0 → singlebehaviorlab-2.2.0}/singlebehaviorlab/backend/training_runner.py +0 -0
- {singlebehaviorlab-2.1.0 → singlebehaviorlab-2.2.0}/singlebehaviorlab/backend/uncertainty.py +0 -0
- {singlebehaviorlab-2.1.0 → singlebehaviorlab-2.2.0}/singlebehaviorlab/backend/video_processor.py +0 -0
- {singlebehaviorlab-2.1.0 → singlebehaviorlab-2.2.0}/singlebehaviorlab/backend/video_utils.py +0 -0
- {singlebehaviorlab-2.1.0 → singlebehaviorlab-2.2.0}/singlebehaviorlab/cli.py +0 -0
- {singlebehaviorlab-2.1.0 → singlebehaviorlab-2.2.0}/singlebehaviorlab/config.py +0 -0
- {singlebehaviorlab-2.1.0 → singlebehaviorlab-2.2.0}/singlebehaviorlab/data/config/config.yaml +0 -0
- {singlebehaviorlab-2.1.0 → singlebehaviorlab-2.2.0}/singlebehaviorlab/data/training_profiles.json +0 -0
- {singlebehaviorlab-2.1.0 → singlebehaviorlab-2.2.0}/singlebehaviorlab/gui/__init__.py +0 -0
- {singlebehaviorlab-2.1.0 → singlebehaviorlab-2.2.0}/singlebehaviorlab/gui/analysis_widget.py +0 -0
- {singlebehaviorlab-2.1.0 → singlebehaviorlab-2.2.0}/singlebehaviorlab/gui/attention_export.py +0 -0
- {singlebehaviorlab-2.1.0 → singlebehaviorlab-2.2.0}/singlebehaviorlab/gui/clip_extraction_widget.py +0 -0
- {singlebehaviorlab-2.1.0 → singlebehaviorlab-2.2.0}/singlebehaviorlab/gui/clustering_widget.py +0 -0
- {singlebehaviorlab-2.1.0 → singlebehaviorlab-2.2.0}/singlebehaviorlab/gui/inference_popups.py +0 -0
- {singlebehaviorlab-2.1.0 → singlebehaviorlab-2.2.0}/singlebehaviorlab/gui/inference_widget.py +0 -0
- {singlebehaviorlab-2.1.0 → singlebehaviorlab-2.2.0}/singlebehaviorlab/gui/inference_worker.py +0 -0
- {singlebehaviorlab-2.1.0 → singlebehaviorlab-2.2.0}/singlebehaviorlab/gui/labeling_widget.py +0 -0
- {singlebehaviorlab-2.1.0 → singlebehaviorlab-2.2.0}/singlebehaviorlab/gui/main_window.py +0 -0
- {singlebehaviorlab-2.1.0 → singlebehaviorlab-2.2.0}/singlebehaviorlab/gui/metadata_management_widget.py +0 -0
- {singlebehaviorlab-2.1.0 → singlebehaviorlab-2.2.0}/singlebehaviorlab/gui/motion_tracking.py +0 -0
- {singlebehaviorlab-2.1.0 → singlebehaviorlab-2.2.0}/singlebehaviorlab/gui/overlay_export.py +0 -0
- {singlebehaviorlab-2.1.0 → singlebehaviorlab-2.2.0}/singlebehaviorlab/gui/plot_integration.py +0 -0
- {singlebehaviorlab-2.1.0 → singlebehaviorlab-2.2.0}/singlebehaviorlab/gui/qt_helpers.py +0 -0
- {singlebehaviorlab-2.1.0 → singlebehaviorlab-2.2.0}/singlebehaviorlab/gui/registration_widget.py +0 -0
- {singlebehaviorlab-2.1.0 → singlebehaviorlab-2.2.0}/singlebehaviorlab/gui/review_widget.py +0 -0
- {singlebehaviorlab-2.1.0 → singlebehaviorlab-2.2.0}/singlebehaviorlab/gui/segmentation_tracking_widget.py +0 -0
- {singlebehaviorlab-2.1.0 → singlebehaviorlab-2.2.0}/singlebehaviorlab/gui/tab_tutorial_dialog.py +0 -0
- {singlebehaviorlab-2.1.0 → singlebehaviorlab-2.2.0}/singlebehaviorlab/gui/timeline_themes.py +0 -0
- {singlebehaviorlab-2.1.0 → singlebehaviorlab-2.2.0}/singlebehaviorlab/gui/training_profiles.py +0 -0
- {singlebehaviorlab-2.1.0 → singlebehaviorlab-2.2.0}/singlebehaviorlab/gui/training_widget.py +0 -0
- {singlebehaviorlab-2.1.0 → singlebehaviorlab-2.2.0}/singlebehaviorlab/gui/video_utils.py +0 -0
- {singlebehaviorlab-2.1.0 → singlebehaviorlab-2.2.0}/singlebehaviorlab/licenses/SAM2-LICENSE +0 -0
- {singlebehaviorlab-2.1.0 → singlebehaviorlab-2.2.0}/singlebehaviorlab/licenses/VideoPrism-LICENSE +0 -0
- {singlebehaviorlab-2.1.0 → singlebehaviorlab-2.2.0}/singlebehaviorlab.egg-info/dependency_links.txt +0 -0
- {singlebehaviorlab-2.1.0 → singlebehaviorlab-2.2.0}/singlebehaviorlab.egg-info/entry_points.txt +0 -0
- {singlebehaviorlab-2.1.0 → singlebehaviorlab-2.2.0}/singlebehaviorlab.egg-info/requires.txt +0 -0
- {singlebehaviorlab-2.1.0 → singlebehaviorlab-2.2.0}/singlebehaviorlab.egg-info/top_level.txt +0 -0
- {singlebehaviorlab-2.1.0 → singlebehaviorlab-2.2.0}/tests/test_clustering_smoke.py +0 -0
- {singlebehaviorlab-2.1.0 → singlebehaviorlab-2.2.0}/tests/test_config.py +0 -0
- {singlebehaviorlab-2.1.0 → singlebehaviorlab-2.2.0}/tests/test_motion_tracking.py +0 -0
- {singlebehaviorlab-2.1.0 → singlebehaviorlab-2.2.0}/tests/test_paths.py +0 -0
- {singlebehaviorlab-2.1.0 → singlebehaviorlab-2.2.0}/tests/test_sam2_smoke.py +0 -0
- {singlebehaviorlab-2.1.0 → singlebehaviorlab-2.2.0}/third_party/sam2_backend/sam2/__init__.py +0 -0
- {singlebehaviorlab-2.1.0 → singlebehaviorlab-2.2.0}/third_party/sam2_backend/sam2/automatic_mask_generator.py +0 -0
- {singlebehaviorlab-2.1.0 → singlebehaviorlab-2.2.0}/third_party/sam2_backend/sam2/benchmark.py +0 -0
- {singlebehaviorlab-2.1.0 → singlebehaviorlab-2.2.0}/third_party/sam2_backend/sam2/build_sam.py +0 -0
- {singlebehaviorlab-2.1.0 → singlebehaviorlab-2.2.0}/third_party/sam2_backend/sam2/configs/sam2/sam2_hiera_b+.yaml +0 -0
- {singlebehaviorlab-2.1.0 → singlebehaviorlab-2.2.0}/third_party/sam2_backend/sam2/configs/sam2/sam2_hiera_l.yaml +0 -0
- {singlebehaviorlab-2.1.0 → singlebehaviorlab-2.2.0}/third_party/sam2_backend/sam2/configs/sam2/sam2_hiera_s.yaml +0 -0
- {singlebehaviorlab-2.1.0 → singlebehaviorlab-2.2.0}/third_party/sam2_backend/sam2/configs/sam2/sam2_hiera_t.yaml +0 -0
- {singlebehaviorlab-2.1.0 → singlebehaviorlab-2.2.0}/third_party/sam2_backend/sam2/configs/sam2.1/sam2.1_hiera_b+.yaml +0 -0
- {singlebehaviorlab-2.1.0 → singlebehaviorlab-2.2.0}/third_party/sam2_backend/sam2/configs/sam2.1/sam2.1_hiera_l.yaml +0 -0
- {singlebehaviorlab-2.1.0 → singlebehaviorlab-2.2.0}/third_party/sam2_backend/sam2/configs/sam2.1/sam2.1_hiera_s.yaml +0 -0
- {singlebehaviorlab-2.1.0 → singlebehaviorlab-2.2.0}/third_party/sam2_backend/sam2/configs/sam2.1/sam2.1_hiera_t.yaml +0 -0
- {singlebehaviorlab-2.1.0 → singlebehaviorlab-2.2.0}/third_party/sam2_backend/sam2/configs/sam2.1_training/sam2.1_hiera_b+_MOSE_finetune.yaml +0 -0
- {singlebehaviorlab-2.1.0 → singlebehaviorlab-2.2.0}/third_party/sam2_backend/sam2/modeling/__init__.py +0 -0
- {singlebehaviorlab-2.1.0 → singlebehaviorlab-2.2.0}/third_party/sam2_backend/sam2/modeling/backbones/__init__.py +0 -0
- {singlebehaviorlab-2.1.0 → singlebehaviorlab-2.2.0}/third_party/sam2_backend/sam2/modeling/backbones/hieradet.py +0 -0
- {singlebehaviorlab-2.1.0 → singlebehaviorlab-2.2.0}/third_party/sam2_backend/sam2/modeling/backbones/image_encoder.py +0 -0
- {singlebehaviorlab-2.1.0 → singlebehaviorlab-2.2.0}/third_party/sam2_backend/sam2/modeling/backbones/utils.py +0 -0
- {singlebehaviorlab-2.1.0 → singlebehaviorlab-2.2.0}/third_party/sam2_backend/sam2/modeling/memory_attention.py +0 -0
- {singlebehaviorlab-2.1.0 → singlebehaviorlab-2.2.0}/third_party/sam2_backend/sam2/modeling/memory_encoder.py +0 -0
- {singlebehaviorlab-2.1.0 → singlebehaviorlab-2.2.0}/third_party/sam2_backend/sam2/modeling/position_encoding.py +0 -0
- {singlebehaviorlab-2.1.0 → singlebehaviorlab-2.2.0}/third_party/sam2_backend/sam2/modeling/sam/__init__.py +0 -0
- {singlebehaviorlab-2.1.0 → singlebehaviorlab-2.2.0}/third_party/sam2_backend/sam2/modeling/sam/mask_decoder.py +0 -0
- {singlebehaviorlab-2.1.0 → singlebehaviorlab-2.2.0}/third_party/sam2_backend/sam2/modeling/sam/prompt_encoder.py +0 -0
- {singlebehaviorlab-2.1.0 → singlebehaviorlab-2.2.0}/third_party/sam2_backend/sam2/modeling/sam/transformer.py +0 -0
- {singlebehaviorlab-2.1.0 → singlebehaviorlab-2.2.0}/third_party/sam2_backend/sam2/modeling/sam2_base.py +0 -0
- {singlebehaviorlab-2.1.0 → singlebehaviorlab-2.2.0}/third_party/sam2_backend/sam2/modeling/sam2_utils.py +0 -0
- {singlebehaviorlab-2.1.0 → singlebehaviorlab-2.2.0}/third_party/sam2_backend/sam2/sam2_hiera_b+.yaml +0 -0
- {singlebehaviorlab-2.1.0 → singlebehaviorlab-2.2.0}/third_party/sam2_backend/sam2/sam2_hiera_l.yaml +0 -0
- {singlebehaviorlab-2.1.0 → singlebehaviorlab-2.2.0}/third_party/sam2_backend/sam2/sam2_hiera_s.yaml +0 -0
- {singlebehaviorlab-2.1.0 → singlebehaviorlab-2.2.0}/third_party/sam2_backend/sam2/sam2_hiera_t.yaml +0 -0
- {singlebehaviorlab-2.1.0 → singlebehaviorlab-2.2.0}/third_party/sam2_backend/sam2/sam2_image_predictor.py +0 -0
- {singlebehaviorlab-2.1.0 → singlebehaviorlab-2.2.0}/third_party/sam2_backend/sam2/sam2_video_predictor.py +0 -0
- {singlebehaviorlab-2.1.0 → singlebehaviorlab-2.2.0}/third_party/sam2_backend/sam2/sam2_video_predictor_legacy.py +0 -0
- {singlebehaviorlab-2.1.0 → singlebehaviorlab-2.2.0}/third_party/sam2_backend/sam2/utils/__init__.py +0 -0
- {singlebehaviorlab-2.1.0 → singlebehaviorlab-2.2.0}/third_party/sam2_backend/sam2/utils/amg.py +0 -0
- {singlebehaviorlab-2.1.0 → singlebehaviorlab-2.2.0}/third_party/sam2_backend/sam2/utils/misc.py +0 -0
- {singlebehaviorlab-2.1.0 → singlebehaviorlab-2.2.0}/third_party/sam2_backend/sam2/utils/transforms.py +0 -0
- {singlebehaviorlab-2.1.0 → singlebehaviorlab-2.2.0}/third_party/videoprism_backend/videoprism/__init__.py +0 -0
- {singlebehaviorlab-2.1.0 → singlebehaviorlab-2.2.0}/third_party/videoprism_backend/videoprism/encoders.py +0 -0
- {singlebehaviorlab-2.1.0 → singlebehaviorlab-2.2.0}/third_party/videoprism_backend/videoprism/layers.py +0 -0
- {singlebehaviorlab-2.1.0 → singlebehaviorlab-2.2.0}/third_party/videoprism_backend/videoprism/models.py +0 -0
- {singlebehaviorlab-2.1.0 → singlebehaviorlab-2.2.0}/third_party/videoprism_backend/videoprism/tokenizers.py +0 -0
- {singlebehaviorlab-2.1.0 → singlebehaviorlab-2.2.0}/third_party/videoprism_backend/videoprism/utils.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: singlebehaviorlab
|
|
3
|
-
Version: 2.
|
|
3
|
+
Version: 2.2.0
|
|
4
4
|
Summary: Semi-automated behavioral video annotation, training, and analysis tool
|
|
5
5
|
Author: Almir Aljovic
|
|
6
6
|
Maintainer: Almir Aljovic
|
|
@@ -200,6 +200,8 @@ Run `singlebehaviorlab <command> --help` for the full flag list on each subcomma
|
|
|
200
200
|
> **Full CLI reference:** [**CLI.md**](CLI.md) — detailed per-command docs, file-format reference, Python API, and troubleshooting.
|
|
201
201
|
>
|
|
202
202
|
> **Notebook demos:** [**demo/**](demo/) — two Jupyter notebooks walking through behavior sequencing and segmentation/clustering end-to-end. Drop your own demo video + prompts into `demo/data/` and step through the cells.
|
|
203
|
+
>
|
|
204
|
+
> **Try it in Colab — no install needed:** [](https://colab.research.google.com/github/alms93/SingleBehaviorLab/blob/main/demo/colab_segmentation_clustering.ipynb) Runs the full segmentation + clustering pipeline on a bundled demo video in a free Colab GPU runtime. Install takes ~5–10 minutes; the pipeline itself finishes in a few minutes.
|
|
203
205
|
|
|
204
206
|
---
|
|
205
207
|
|
|
@@ -133,6 +133,8 @@ Run `singlebehaviorlab <command> --help` for the full flag list on each subcomma
|
|
|
133
133
|
> **Full CLI reference:** [**CLI.md**](CLI.md) — detailed per-command docs, file-format reference, Python API, and troubleshooting.
|
|
134
134
|
>
|
|
135
135
|
> **Notebook demos:** [**demo/**](demo/) — two Jupyter notebooks walking through behavior sequencing and segmentation/clustering end-to-end. Drop your own demo video + prompts into `demo/data/` and step through the cells.
|
|
136
|
+
>
|
|
137
|
+
> **Try it in Colab — no install needed:** [](https://colab.research.google.com/github/alms93/SingleBehaviorLab/blob/main/demo/colab_segmentation_clustering.ipynb) Runs the full segmentation + clustering pipeline on a bundled demo video in a free Colab GPU runtime. Install takes ~5–10 minutes; the pipeline itself finishes in a few minutes.
|
|
136
138
|
|
|
137
139
|
---
|
|
138
140
|
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "singlebehaviorlab"
|
|
7
|
-
version = "2.
|
|
7
|
+
version = "2.2.0"
|
|
8
8
|
description = "Semi-automated behavioral video annotation, training, and analysis tool"
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
license = { file = "LICENSE" }
|
|
@@ -19,7 +19,7 @@ or videoprism. Each symbol triggers its underlying backend module only on
|
|
|
19
19
|
first access.
|
|
20
20
|
"""
|
|
21
21
|
|
|
22
|
-
__version__ = "2.
|
|
22
|
+
__version__ = "2.2.0"
|
|
23
23
|
__author__ = "Almir Aljovic"
|
|
24
24
|
|
|
25
25
|
# Mapping of public name → (backend module, attribute name).
|
|
@@ -35,6 +35,8 @@ _PUBLIC_API = {
|
|
|
35
35
|
"infer": ("singlebehaviorlab.backend.inference", "run_inference_on_video"),
|
|
36
36
|
"train": ("singlebehaviorlab.backend.training_runner", "run_training_session"),
|
|
37
37
|
"load_config": ("singlebehaviorlab.config", "load_config"),
|
|
38
|
+
"load_demo": ("singlebehaviorlab.demo", "load_demo"),
|
|
39
|
+
"DEMOS": ("singlebehaviorlab.demo", "DEMOS"),
|
|
38
40
|
}
|
|
39
41
|
|
|
40
42
|
__all__ = ["__version__", "__author__", *sorted(_PUBLIC_API)]
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
"""Downloadable demo datasets for trying SingleBehaviorLab end-to-end.
|
|
2
|
+
|
|
3
|
+
Each entry in :data:`DEMOS` maps a short name to a list of ``(filename, url)``
|
|
4
|
+
pairs. :func:`load_demo` downloads the listed files into a local cache
|
|
5
|
+
directory and returns a dict mapping logical asset names to absolute paths,
|
|
6
|
+
so the pipeline functions can be called directly on the returned values::
|
|
7
|
+
|
|
8
|
+
import singlebehaviorlab as sbl
|
|
9
|
+
|
|
10
|
+
demo = sbl.load_demo("segmentation_clustering")
|
|
11
|
+
sbl.segment(demo["video"], demo["prompts"], "masks.h5")
|
|
12
|
+
|
|
13
|
+
The asset URLs are pinned to a released tag so existing notebooks keep
|
|
14
|
+
working when ``main`` moves forward.
|
|
15
|
+
"""
|
|
16
|
+
|
|
17
|
+
from __future__ import annotations
|
|
18
|
+
|
|
19
|
+
import os
|
|
20
|
+
import shutil
|
|
21
|
+
import urllib.request
|
|
22
|
+
from dataclasses import dataclass
|
|
23
|
+
from pathlib import Path
|
|
24
|
+
from typing import Optional
|
|
25
|
+
|
|
26
|
+
__all__ = ["DEMOS", "DemoAsset", "load_demo"]
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
_TAG = "v2.1.0"
|
|
30
|
+
_RAW_BASE = f"https://raw.githubusercontent.com/alms93/SingleBehaviorLab/{_TAG}"
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
@dataclass(frozen=True)
|
|
34
|
+
class DemoAsset:
|
|
35
|
+
"""One file that belongs to a demo dataset."""
|
|
36
|
+
|
|
37
|
+
key: str # logical name, e.g. "video" or "prompts"
|
|
38
|
+
filename: str # on-disk filename under the cache directory
|
|
39
|
+
url: str # remote URL to download from
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
DEMOS: dict[str, list[DemoAsset]] = {
|
|
43
|
+
"segmentation_clustering": [
|
|
44
|
+
DemoAsset(
|
|
45
|
+
key="video",
|
|
46
|
+
filename="Demo_video.mp4",
|
|
47
|
+
url=f"{_RAW_BASE}/demo/data/segmentation_clustering/Demo_video.mp4",
|
|
48
|
+
),
|
|
49
|
+
DemoAsset(
|
|
50
|
+
key="prompts",
|
|
51
|
+
filename="sam2_prompts.json",
|
|
52
|
+
url=f"{_RAW_BASE}/demo/data/segmentation_clustering/sam2_prompts.json",
|
|
53
|
+
),
|
|
54
|
+
],
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
def _default_cache_dir() -> Path:
|
|
59
|
+
override = os.environ.get("SBL_DEMO_DIR")
|
|
60
|
+
if override:
|
|
61
|
+
return Path(override).expanduser().resolve()
|
|
62
|
+
return Path.home() / ".cache" / "singlebehaviorlab" / "demos"
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
def _download_with_progress(url: str, dest: Path) -> None:
|
|
66
|
+
dest.parent.mkdir(parents=True, exist_ok=True)
|
|
67
|
+
tmp_path = dest.with_suffix(dest.suffix + ".part")
|
|
68
|
+
try:
|
|
69
|
+
from tqdm.auto import tqdm as _tqdm
|
|
70
|
+
except Exception:
|
|
71
|
+
_tqdm = None # type: ignore[assignment]
|
|
72
|
+
|
|
73
|
+
if _tqdm is None:
|
|
74
|
+
with urllib.request.urlopen(url) as response, open(tmp_path, "wb") as f:
|
|
75
|
+
shutil.copyfileobj(response, f)
|
|
76
|
+
else:
|
|
77
|
+
with urllib.request.urlopen(url) as response:
|
|
78
|
+
total = int(response.headers.get("Content-Length") or 0) or None
|
|
79
|
+
with _tqdm(
|
|
80
|
+
total=total,
|
|
81
|
+
unit="B",
|
|
82
|
+
unit_scale=True,
|
|
83
|
+
unit_divisor=1024,
|
|
84
|
+
desc=dest.name,
|
|
85
|
+
leave=False,
|
|
86
|
+
) as bar:
|
|
87
|
+
with open(tmp_path, "wb") as f:
|
|
88
|
+
while True:
|
|
89
|
+
chunk = response.read(1024 * 64)
|
|
90
|
+
if not chunk:
|
|
91
|
+
break
|
|
92
|
+
f.write(chunk)
|
|
93
|
+
bar.update(len(chunk))
|
|
94
|
+
tmp_path.replace(dest)
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
def load_demo(
|
|
98
|
+
name: str = "segmentation_clustering",
|
|
99
|
+
*,
|
|
100
|
+
destination: Optional[str | os.PathLike[str]] = None,
|
|
101
|
+
force: bool = False,
|
|
102
|
+
) -> dict[str, str]:
|
|
103
|
+
"""Download (or reuse a cached copy of) a demo dataset.
|
|
104
|
+
|
|
105
|
+
Args:
|
|
106
|
+
name: Registered demo name. Currently ``"segmentation_clustering"``
|
|
107
|
+
is the only entry; more will follow as additional demos land.
|
|
108
|
+
destination: Optional override for the cache directory. Defaults to
|
|
109
|
+
``$SBL_DEMO_DIR`` if set, otherwise
|
|
110
|
+
``~/.cache/singlebehaviorlab/demos/``.
|
|
111
|
+
force: Re-download even if the files already exist locally.
|
|
112
|
+
|
|
113
|
+
Returns:
|
|
114
|
+
A dict mapping each asset's ``key`` to an absolute path on disk, e.g.
|
|
115
|
+
``{"video": "/root/.cache/.../Demo_video.mp4", "prompts": "..."}``.
|
|
116
|
+
"""
|
|
117
|
+
if name not in DEMOS:
|
|
118
|
+
available = ", ".join(sorted(DEMOS.keys()))
|
|
119
|
+
raise KeyError(f"Unknown demo '{name}'. Available demos: {available}")
|
|
120
|
+
|
|
121
|
+
cache_root = Path(destination).expanduser().resolve() if destination else _default_cache_dir()
|
|
122
|
+
demo_dir = cache_root / name
|
|
123
|
+
demo_dir.mkdir(parents=True, exist_ok=True)
|
|
124
|
+
|
|
125
|
+
paths: dict[str, str] = {}
|
|
126
|
+
for asset in DEMOS[name]:
|
|
127
|
+
target = demo_dir / asset.filename
|
|
128
|
+
if force or not target.exists() or target.stat().st_size == 0:
|
|
129
|
+
_download_with_progress(asset.url, target)
|
|
130
|
+
paths[asset.key] = str(target)
|
|
131
|
+
return paths
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: singlebehaviorlab
|
|
3
|
-
Version: 2.
|
|
3
|
+
Version: 2.2.0
|
|
4
4
|
Summary: Semi-automated behavioral video annotation, training, and analysis tool
|
|
5
5
|
Author: Almir Aljovic
|
|
6
6
|
Maintainer: Almir Aljovic
|
|
@@ -200,6 +200,8 @@ Run `singlebehaviorlab <command> --help` for the full flag list on each subcomma
|
|
|
200
200
|
> **Full CLI reference:** [**CLI.md**](CLI.md) — detailed per-command docs, file-format reference, Python API, and troubleshooting.
|
|
201
201
|
>
|
|
202
202
|
> **Notebook demos:** [**demo/**](demo/) — two Jupyter notebooks walking through behavior sequencing and segmentation/clustering end-to-end. Drop your own demo video + prompts into `demo/data/` and step through the cells.
|
|
203
|
+
>
|
|
204
|
+
> **Try it in Colab — no install needed:** [](https://colab.research.google.com/github/alms93/SingleBehaviorLab/blob/main/demo/colab_segmentation_clustering.ipynb) Runs the full segmentation + clustering pipeline on a bundled demo video in a free Colab GPU runtime. Install takes ~5–10 minutes; the pipeline itself finishes in a few minutes.
|
|
203
205
|
|
|
204
206
|
---
|
|
205
207
|
|
|
@@ -6,6 +6,7 @@ singlebehaviorlab/__main__.py
|
|
|
6
6
|
singlebehaviorlab/_paths.py
|
|
7
7
|
singlebehaviorlab/cli.py
|
|
8
8
|
singlebehaviorlab/config.py
|
|
9
|
+
singlebehaviorlab/demo.py
|
|
9
10
|
singlebehaviorlab.egg-info/PKG-INFO
|
|
10
11
|
singlebehaviorlab.egg-info/SOURCES.txt
|
|
11
12
|
singlebehaviorlab.egg-info/dependency_links.txt
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{singlebehaviorlab-2.1.0 → singlebehaviorlab-2.2.0}/singlebehaviorlab/backend/augmentations.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{singlebehaviorlab-2.1.0 → singlebehaviorlab-2.2.0}/singlebehaviorlab/backend/registration.py
RENAMED
|
File without changes
|
{singlebehaviorlab-2.1.0 → singlebehaviorlab-2.2.0}/singlebehaviorlab/backend/segmentation.py
RENAMED
|
File without changes
|
|
File without changes
|
{singlebehaviorlab-2.1.0 → singlebehaviorlab-2.2.0}/singlebehaviorlab/backend/training_runner.py
RENAMED
|
File without changes
|
{singlebehaviorlab-2.1.0 → singlebehaviorlab-2.2.0}/singlebehaviorlab/backend/uncertainty.py
RENAMED
|
File without changes
|
{singlebehaviorlab-2.1.0 → singlebehaviorlab-2.2.0}/singlebehaviorlab/backend/video_processor.py
RENAMED
|
File without changes
|
{singlebehaviorlab-2.1.0 → singlebehaviorlab-2.2.0}/singlebehaviorlab/backend/video_utils.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{singlebehaviorlab-2.1.0 → singlebehaviorlab-2.2.0}/singlebehaviorlab/data/config/config.yaml
RENAMED
|
File without changes
|
{singlebehaviorlab-2.1.0 → singlebehaviorlab-2.2.0}/singlebehaviorlab/data/training_profiles.json
RENAMED
|
File without changes
|
|
File without changes
|
{singlebehaviorlab-2.1.0 → singlebehaviorlab-2.2.0}/singlebehaviorlab/gui/analysis_widget.py
RENAMED
|
File without changes
|
{singlebehaviorlab-2.1.0 → singlebehaviorlab-2.2.0}/singlebehaviorlab/gui/attention_export.py
RENAMED
|
File without changes
|
{singlebehaviorlab-2.1.0 → singlebehaviorlab-2.2.0}/singlebehaviorlab/gui/clip_extraction_widget.py
RENAMED
|
File without changes
|
{singlebehaviorlab-2.1.0 → singlebehaviorlab-2.2.0}/singlebehaviorlab/gui/clustering_widget.py
RENAMED
|
File without changes
|
{singlebehaviorlab-2.1.0 → singlebehaviorlab-2.2.0}/singlebehaviorlab/gui/inference_popups.py
RENAMED
|
File without changes
|
{singlebehaviorlab-2.1.0 → singlebehaviorlab-2.2.0}/singlebehaviorlab/gui/inference_widget.py
RENAMED
|
File without changes
|
{singlebehaviorlab-2.1.0 → singlebehaviorlab-2.2.0}/singlebehaviorlab/gui/inference_worker.py
RENAMED
|
File without changes
|
{singlebehaviorlab-2.1.0 → singlebehaviorlab-2.2.0}/singlebehaviorlab/gui/labeling_widget.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{singlebehaviorlab-2.1.0 → singlebehaviorlab-2.2.0}/singlebehaviorlab/gui/motion_tracking.py
RENAMED
|
File without changes
|
|
File without changes
|
{singlebehaviorlab-2.1.0 → singlebehaviorlab-2.2.0}/singlebehaviorlab/gui/plot_integration.py
RENAMED
|
File without changes
|
|
File without changes
|
{singlebehaviorlab-2.1.0 → singlebehaviorlab-2.2.0}/singlebehaviorlab/gui/registration_widget.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{singlebehaviorlab-2.1.0 → singlebehaviorlab-2.2.0}/singlebehaviorlab/gui/tab_tutorial_dialog.py
RENAMED
|
File without changes
|
{singlebehaviorlab-2.1.0 → singlebehaviorlab-2.2.0}/singlebehaviorlab/gui/timeline_themes.py
RENAMED
|
File without changes
|
{singlebehaviorlab-2.1.0 → singlebehaviorlab-2.2.0}/singlebehaviorlab/gui/training_profiles.py
RENAMED
|
File without changes
|
{singlebehaviorlab-2.1.0 → singlebehaviorlab-2.2.0}/singlebehaviorlab/gui/training_widget.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{singlebehaviorlab-2.1.0 → singlebehaviorlab-2.2.0}/singlebehaviorlab/licenses/VideoPrism-LICENSE
RENAMED
|
File without changes
|
{singlebehaviorlab-2.1.0 → singlebehaviorlab-2.2.0}/singlebehaviorlab.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
{singlebehaviorlab-2.1.0 → singlebehaviorlab-2.2.0}/singlebehaviorlab.egg-info/entry_points.txt
RENAMED
|
File without changes
|
|
File without changes
|
{singlebehaviorlab-2.1.0 → singlebehaviorlab-2.2.0}/singlebehaviorlab.egg-info/top_level.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{singlebehaviorlab-2.1.0 → singlebehaviorlab-2.2.0}/third_party/sam2_backend/sam2/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
{singlebehaviorlab-2.1.0 → singlebehaviorlab-2.2.0}/third_party/sam2_backend/sam2/benchmark.py
RENAMED
|
File without changes
|
{singlebehaviorlab-2.1.0 → singlebehaviorlab-2.2.0}/third_party/sam2_backend/sam2/build_sam.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{singlebehaviorlab-2.1.0 → singlebehaviorlab-2.2.0}/third_party/sam2_backend/sam2/sam2_hiera_b+.yaml
RENAMED
|
File without changes
|
{singlebehaviorlab-2.1.0 → singlebehaviorlab-2.2.0}/third_party/sam2_backend/sam2/sam2_hiera_l.yaml
RENAMED
|
File without changes
|
{singlebehaviorlab-2.1.0 → singlebehaviorlab-2.2.0}/third_party/sam2_backend/sam2/sam2_hiera_s.yaml
RENAMED
|
File without changes
|
{singlebehaviorlab-2.1.0 → singlebehaviorlab-2.2.0}/third_party/sam2_backend/sam2/sam2_hiera_t.yaml
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{singlebehaviorlab-2.1.0 → singlebehaviorlab-2.2.0}/third_party/sam2_backend/sam2/utils/__init__.py
RENAMED
|
File without changes
|
{singlebehaviorlab-2.1.0 → singlebehaviorlab-2.2.0}/third_party/sam2_backend/sam2/utils/amg.py
RENAMED
|
File without changes
|
{singlebehaviorlab-2.1.0 → singlebehaviorlab-2.2.0}/third_party/sam2_backend/sam2/utils/misc.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|