Skip to content

Commit 1627433

Browse files
authored
Merge pull request #74 from sidhulyalkar/main
DLC bugfix
2 parents 1b78339 + 92764ae commit 1627433

File tree

3 files changed

+13
-13
lines changed

3 files changed

+13
-13
lines changed

element_deeplabcut/model.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -374,7 +374,7 @@ def insert_new_model(
374374
prompt (bool): Optional. Prompt the user with all info before inserting.
375375
params (dict): Optional. If dlc_config is path, dict of override items
376376
"""
377-
from deeplabcut.utils.auxiliaryfunctions import GetScorerName # isort:skip
377+
from deeplabcut.utils.auxiliaryfunctions import GetScorerName # isort:skip
378378

379379
# handle dlc_config being a yaml file
380380
if not isinstance(dlc_config, dict):
@@ -392,7 +392,7 @@ def insert_new_model(
392392
project_path = find_full_path(
393393
get_dlc_root_data_dir(), dlc_config.get("project_path", project_path)
394394
)
395-
dlc_config["project_path"] = str(project_path) # update if different
395+
dlc_config["project_path"] = project_path.as_posix() # update if different
396396
root_dir = find_root_directory(get_dlc_root_data_dir(), project_path)
397397

398398
# ---- Verify config ----
@@ -488,8 +488,11 @@ class ModelEvaluation(dj.Computed):
488488
"""
489489

490490
def make(self, key):
491-
from deeplabcut import evaluate_network # isort:skip
492-
from deeplabcut.utils.auxiliaryfunctions import get_evaluation_folder # isort:skip
491+
from deeplabcut import evaluate_network # isort:skip
492+
from deeplabcut.utils.auxiliaryfunctions import (
493+
get_evaluation_folder,
494+
) # isort:skip
495+
493496
""".populate() method will launch evaluation for each unique entry in Model."""
494497
dlc_config, project_path, model_prefix, shuffle, trainingsetindex = (
495498
Model & key
@@ -719,6 +722,7 @@ def make(self, key):
719722
) or {}
720723

721724
dlc_reader.do_pose_estimation(
725+
key,
722726
video_filepaths,
723727
dlc_model,
724728
project_path,

element_deeplabcut/readers/dlc_reader.py

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,7 @@ def save_yaml(
249249

250250

251251
def do_pose_estimation(
252+
key: dict,
252253
video_filepaths: list,
253254
dlc_model: dict,
254255
project_path: str,
@@ -334,15 +335,10 @@ def do_pose_estimation(
334335
# ---- Add current video to config ---
335336
for video_filepath in video_filepaths:
336337
if video_filepath not in dlc_config["video_sets"]:
337-
root_dir = find_root_directory(get_dlc_root_data_dir(), video_filepath)
338-
relative_path = Path(video_filepath).relative_to(root_dir)
339-
recording_id = (
340-
model.VideoRecording.File & f'file_path="{relative_path}"'
341-
).fetch1("recording_id")
342338
try:
343-
px_width, px_height = (
344-
model.RecordingInfo & f'recording_id="{recording_id}"'
345-
).fetch1("px_width", "px_height")
339+
px_width, px_height = (model.RecordingInfo & key).fetch1(
340+
"px_width", "px_height"
341+
)
346342
except DataJointError:
347343
logger.warn(
348344
f"Could not find RecordingInfo for {video_filepath.stem}"

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
datajoint>=0.13
22
deeplabcut[tf]>=2.2.1.1
33
element-interface>=0.3.0
4-
opencv-python-headless
4+
opencv-python-headless

0 commit comments

Comments
 (0)