Skip to content

Commit b493bef

Browse files
committed
Benchmark pytorch: dont setup videowriter if not needed
1 parent 045de53 commit b493bef

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

dlclive/benchmark_pytorch.py

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -186,15 +186,16 @@ def benchmark(
186186
# Retrieve bodypart names and number of keypoints
187187
bodyparts = dlc_live.read_config()["metadata"]["bodyparts"]
188188

189-
colors, vwriter = setup_video_writer(
190-
video_path=video_path,
191-
save_dir=save_dir,
192-
timestamp=timestamp,
193-
num_keypoints=len(bodyparts),
194-
cmap=cmap,
195-
fps=cap.get(cv2.CAP_PROP_FPS),
196-
frame_size=(int(cap.get(cv2.CAP_PROP_FRAME_WIDTH)), int(cap.get(cv2.CAP_PROP_FRAME_HEIGHT))),
197-
)
189+
if save_video:
190+
colors, vwriter = setup_video_writer(
191+
video_path=video_path,
192+
save_dir=save_dir,
193+
timestamp=timestamp,
194+
num_keypoints=len(bodyparts),
195+
cmap=cmap,
196+
fps=cap.get(cv2.CAP_PROP_FPS),
197+
frame_size=(int(cap.get(cv2.CAP_PROP_FRAME_WIDTH)), int(cap.get(cv2.CAP_PROP_FRAME_HEIGHT))),
198+
)
198199

199200
# Start empty dict to save poses to for each frame
200201
poses, times = [], []

0 commit comments

Comments
 (0)