descriptron-vision 2.0.1__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.
- descriptron_vision/__init__.py +0 -0
- descriptron_vision/cli.py +66 -0
- descriptron_vision/tools/biosyslit_rag_retrieval.py +4285 -0
- descriptron_vision/tools/dinov3_landmark_transfer_v51.py +903 -0
- descriptron_vision/tools/measurement_script_to_try_after_kpts_prediction_measure_kpts_V35.py +2049 -0
- descriptron_vision/tools/sam2_pal_batch_v21.py +3307 -0
- descriptron_vision/tools/torchvision_det/README.md +108 -0
- descriptron_vision/tools/torchvision_det/d2_predict_fold_v1.py +99 -0
- descriptron_vision/tools/torchvision_det/fix_coco_image_sizes_v1.py +95 -0
- descriptron_vision/tools/torchvision_det/render_detections_v1.py +179 -0
- descriptron_vision/tools/torchvision_det/run_20k_comparison.sh +90 -0
- descriptron_vision/tools/torchvision_det/tv_coco_dataset.py +405 -0
- descriptron_vision/tools/torchvision_det/tv_predict_v1.py +253 -0
- descriptron_vision/tools/torchvision_det/tv_sweep_v1.py +331 -0
- descriptron_vision/tools/torchvision_det/tv_train_v1.py +283 -0
- descriptron_vision-2.0.1.dist-info/METADATA +68 -0
- descriptron_vision-2.0.1.dist-info/RECORD +21 -0
- descriptron_vision-2.0.1.dist-info/WHEEL +4 -0
- descriptron_vision-2.0.1.dist-info/entry_points.txt +7 -0
- descriptron_vision-2.0.1.dist-info/licenses/LICENSE +201 -0
- descriptron_vision-2.0.1.dist-info/licenses/NOTICE +52 -0
|
File without changes
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"""
|
|
2
|
+
descriptron_vision.cli — detectors, propagation and landmark transfer
|
|
3
|
+
=====================================================================
|
|
4
|
+
|
|
5
|
+
Same dispatch as `descriptron_core.cli`. The two dependencies that are not on
|
|
6
|
+
PyPI — SAM2 and Detectron2 — are not declared anywhere: PyPI rejects a git
|
|
7
|
+
dependency in package metadata. They are imported lazily by the programs that
|
|
8
|
+
need them, and `require()` below turns the resulting ImportError into the exact
|
|
9
|
+
command to run.
|
|
10
|
+
"""
|
|
11
|
+
from __future__ import annotations
|
|
12
|
+
|
|
13
|
+
import sys
|
|
14
|
+
|
|
15
|
+
from descriptron_core.cli import run as _run_core # noqa: F401 (shared behaviour)
|
|
16
|
+
from descriptron_core.cli import data_path # noqa: F401
|
|
17
|
+
|
|
18
|
+
import os
|
|
19
|
+
import runpy
|
|
20
|
+
from importlib.resources import files
|
|
21
|
+
from pathlib import Path
|
|
22
|
+
|
|
23
|
+
INSTALL_HINTS = {
|
|
24
|
+
"sam2": ("SAM2 is not on PyPI, so it cannot be a declared dependency.\n"
|
|
25
|
+
" pip install git+https://github.com/facebookresearch/segment-anything-2"),
|
|
26
|
+
"detectron2": ("Detectron2 is not on PyPI and must be compiled:\n"
|
|
27
|
+
" pip install git+https://github.com/facebookresearch/detectron2\n"
|
|
28
|
+
"It needs a C++/CUDA toolchain and has no macOS wheels. If you would\n"
|
|
29
|
+
"rather not build it, the Docker image carries it ready to run, and the\n"
|
|
30
|
+
"torchvision backend needs none of this."),
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
def require(module: str):
|
|
35
|
+
"""Import an optional heavyweight dependency, or explain how to get it."""
|
|
36
|
+
try:
|
|
37
|
+
return __import__(module)
|
|
38
|
+
except ImportError as exc:
|
|
39
|
+
hint = INSTALL_HINTS.get(module, f" pip install {module}")
|
|
40
|
+
raise SystemExit(f"{module} is required for this step but is not installed.\n"
|
|
41
|
+
f"{hint}\n\n(original error: {exc})") from exc
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
def tools_dir() -> Path:
|
|
45
|
+
return Path(str(files("descriptron_vision") / "tools"))
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
def _run(script: str, argv: list[str], subdir: str | None = None) -> None:
|
|
49
|
+
base = tools_dir() / subdir if subdir else tools_dir()
|
|
50
|
+
path = base / script
|
|
51
|
+
if not path.exists():
|
|
52
|
+
raise SystemExit(f"{path} is missing — was sync_sources.py run before building?")
|
|
53
|
+
sys.path.insert(0, str(path.parent))
|
|
54
|
+
sys.path.insert(0, str(tools_dir()))
|
|
55
|
+
os.environ.setdefault("DESCRIPTRON_DATA", str(data_path()))
|
|
56
|
+
sys.argv = [str(path), *argv]
|
|
57
|
+
runpy.run_path(str(path), run_name="__main__")
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
def train(): _run("tv_train_v1.py", sys.argv[1:], "torchvision_det")
|
|
61
|
+
def predict(): _run("tv_predict_v1.py", sys.argv[1:], "torchvision_det")
|
|
62
|
+
def sweep(): _run("tv_sweep_v1.py", sys.argv[1:], "torchvision_det")
|
|
63
|
+
def sam2_pal(): _run("sam2_pal_batch_v21.py", sys.argv[1:])
|
|
64
|
+
def dinoland(): _run("dinov3_landmark_transfer_v51.py", sys.argv[1:])
|
|
65
|
+
def measure():
|
|
66
|
+
_run("measurement_script_to_try_after_kpts_prediction_measure_kpts_V35.py", sys.argv[1:])
|