Skip to content

Commit a00af6c

Browse files
committed
Benchmark pytorch: fix read config
1 parent fb1314e commit a00af6c

File tree

3 files changed

+16
-5
lines changed

3 files changed

+16
-5
lines changed

dlclive/benchmark_pytorch.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ def analyze_video(
179179
frame_index = 0
180180

181181
# Retrieve bodypart names and number of keypoints
182-
bodyparts = dlc_live.cfg["metadata"]["bodyparts"]
182+
bodyparts = dlc_live.read_config()["metadata"]["bodyparts"]
183183
num_keypoints = len(bodyparts)
184184

185185
if save_video:

dlclive/core/runner.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,14 @@ def init_inference(self, frame: np.ndarray | None, **kwargs) -> np.ndarray | Non
8787
pass
8888

8989
@abc.abstractmethod
90-
def read_config(self):
91-
"""Reads the pose configuration file.
90+
def read_config(self) -> dict:
91+
"""
92+
Reads the pose configuration file.
93+
94+
Returns
95+
-------
96+
dict
97+
The runner configuration
9298
9399
Raises:
94100
FileNotFoundError: if the pose configuration file does not exist

dlclive/dlclive.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -214,15 +214,20 @@ def cfg(self) -> dict | None:
214214
def precision(self) -> str:
215215
return self.runner.precision
216216

217-
def read_config(self) -> None:
217+
def read_config(self) -> dict:
218218
"""Reads configuration yaml file
219219
220+
Returns
221+
-------
222+
dict
223+
The configuration
224+
220225
Raises
221226
------
222227
FileNotFoundError
223228
error thrown if pose configuration file does not exist
224229
"""
225-
self.runner.read_config()
230+
return self.runner.read_config()
226231

227232
@property
228233
def parameterization(

0 commit comments

Comments
 (0)