Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 15 additions & 26 deletions dlclivegui/gui/camera_config_dialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,25 +134,7 @@ def run(self):
self.progress.emit("Probing device defaults…")
if self._cancel:
return
be = CameraFactory.create(self._cam)
be.open()

actual_res = getattr(be, "actual_resolution", None)
actual_fps = getattr(be, "actual_fps", None)

try:
be.close()
except Exception:
pass

if self._cancel:
return

self.success.emit({
"cam": self._cam,
"actual_resolution": actual_res,
"actual_fps": actual_fps,
})
self.success.emit(self._cam)
except Exception as exc:
self.error.emit(f"{type(exc).__name__}: {exc}")
finally:
Expand Down Expand Up @@ -1239,20 +1221,27 @@ def _reset_selected_camera(self, *, clear_backend_cache: bool = False) -> None:
self.apply_settings_btn.setEnabled(True)

def _on_probe_success(self, payload) -> None:
"""Apply probe results to working model and refresh UI.
"""Open/close quickly to read actual_resolution/actual_fps and store as detected_*.

If self._probe_apply_to_requested is True, also overwrite requested width/height/fps
for the targeted camera row (Reset behavior).
"""
if not isinstance(payload, dict):
return
cam_settings = payload.get("cam")
if not isinstance(cam_settings, CameraSettings):
if not isinstance(payload, CameraSettings):
return
actual_res = payload.get("actual_resolution")
actual_fps = payload.get("actual_fps")
cam_settings = payload

try:
be = CameraFactory.create(cam_settings)
be.open()

actual_res = getattr(be, "actual_resolution", None)
actual_fps = getattr(be, "actual_fps", None)

try:
be.close()
except Exception:
pass

backend = (cam_settings.backend or "").lower()

for i, c in enumerate(self._working_settings.cameras):
Expand Down
21 changes: 16 additions & 5 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ classifiers = [
]

dependencies = [
"deeplabcut-live>=2.0.0", # might be missing timm and scipy
# "deeplabcut-live>=2.0.0", # might be missing timm and scipy
"PySide6",
"qdarkstyle",
"numpy",
Expand All @@ -43,11 +43,22 @@ dependencies = [
basler = ["pypylon"]
gentl = ["harvesters"]
all = ["pypylon", "harvesters"]
pytorch = [
"deeplabcut-live[pytorch]>=2.0.0", # this includes timm and scipy
live-latest = [
"deeplabcut-live@git+https://github.com/DeepLabCut/DeepLabCut-live.git@main#egg=deeplabcut-live",
]
tf = [
"deeplabcut-live[tf]>=2.0.0",
live-latest-pytorch = [
# this includes timm and scipy
"deeplabcut-live@git+https://github.com/DeepLabCut/DeepLabCut-live.git@main#egg=deeplabcut-live[pytorch]",
]
# TODO @C-Achard uncomment when 2.0 is released on PyPI, and remove live-latest*
# pytorch = [
# "deeplabcut-live[pytorch]>=2.0.0", # this includes timm and scipy
# ]
# tf = [
# "deeplabcut-live[tf]>=2.0.0",
# ]
live-latest-tf = [
"deeplabcut-live@git+https://github.com/DeepLabCut/DeepLabCut-live.git@main#egg=deeplabcut-live[tf]",
]
dev = [
"pytest>=7.0",
Expand Down