Is there an existing issue for this?
Operating System
Windows 11 and Linux
DeepLabCut version
3.0.0rc13
What engine are you using?
pytorch
DeepLabCut mode
single animal
Device type
NVIDIA Geforce RTX 4070 Laptop GPU (windows 11)
NVIDIA RTX 2000 Ada Generation (Linux)
Bug description 🐛
With the PyTorch engine (top-down: detector + pose), deeplabcut.analyze_videos crashes with OverflowError: cannot convert float infinity to integer when a video produces no detections on any frame, so the predictions list is empty.
In _generate_output_data, the key width is computed as:
deeplabcut/pose_estimation_pytorch/apis/videos.py (v3.0.0rc13, line 903)
str_width = int(np.ceil(np.log10(len(predictions))))
When len(predictions) == 0, np.log10(0) = -inf and int(np.ceil(-inf)) raises OverflowError, aborting the whole analyze_videos call.
This happens legitimately whenever a clip contains no animal the detector recognizes (e.g. a setup/handling segment recorded before the actual trial). The empty-predictions condition is even detected just upstream, in video_inference:
same file, ~lines 232-240
if shelf_writer is None and len(predictions) != n_frames:
logging.warning(
f"The video metadata indicates that there {n_frames} in the video, but "
f"only {len(predictions)} were able to be processed. This can happen if "
"the video is corrupted. ..."
)
…but it is only warned about, not guarded against downstream, so the run still crashes.
Steps To Reproduce
- A top-down PyTorch project (e.g. fasterrcnn_mobilenet_v3_large_fpn detector + HRNet pose).
- Run deeplabcut.analyze_videos(config, [video], shuffle=N) on a video in which the animal is absent (or simply never detected).
- The detector and pose progress bars both run over all N frames, then the "only 0 were able to be processed" warning is logged, immediately followed by the crash.
Relevant log output
OverflowError: cannot convert float infinity to integer
2026-09-07 11:38:53 ERROR Abandon de droite_GX010420.MP4 après 2 tentative(s)
2026-09-07 11:38:53 INFO DeepLabCut : analyse de 1 vidéo(s) [shuffle=3] (.h5 à côté des vidéos)
2026-09-07 11:39:32 ERROR Crash DLC (coupable probable : gauche_GX010606.MP4)
Traceback (most recent call last):
File "/home/Documents/workspaces/bar_test/pipeline_deeplabcut/run_inference.py", line 104, in analyze_with_retries
analyze_with_dlc(config, batch, destfolder, batch_size, detector_batch_size,
File "/home/mlalaque/Documents/workspaces/bar_test/pipeline_deeplabcut/run_inference.py", line 67, in analyze_with_dlc
deeplabcut.analyze_videos(
File "/home/miniconda3/envs/dlc/lib/python3.12/site-packages/deeplabcut/utils/deprecation.py", line 198, in wrapper
return fn(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^
File "/home/miniconda3/envs/dlc/lib/python3.12/site-packages/deeplabcut/utils/deprecation.py", line 198, in wrapper
return fn(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^
File "/home/miniconda3/envs/dlc/lib/python3.12/site-packages/deeplabcut/compat.py", line 973, in analyze_videos
return analyze_videos(
^^^^^^^^^^^^^^^
File "/home/miniconda3/envs/dlc/lib/python3.12/site-packages/deeplabcut/utils/deprecation.py", line 198, in wrapper
return fn(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^
File "/home/miniconda3/envs/dlc/lib/python3.12/site-packages/deeplabcut/pose_estimation_pytorch/apis/videos.py", line 612, in analyze_videos
output_data = _generate_output_data(pose_cfg, predictions)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/miniconda3/envs/dlc/lib/python3.12/site-packages/deeplabcut/pose_estimation_pytorch/apis/videos.py", line 898, in _generate_output_data
str_width = int(np.ceil(np.log10(len(predictions))))
Anything else?
Even though the error is not that problematic since it is triggered by videos with no mouse that could or should be skipped, the current warning is misleading and points at video corruption.
Code of Conduct
Is there an existing issue for this?
Operating System
Windows 11 and Linux
DeepLabCut version
3.0.0rc13
What engine are you using?
pytorch
DeepLabCut mode
single animal
Device type
NVIDIA Geforce RTX 4070 Laptop GPU (windows 11)
NVIDIA RTX 2000 Ada Generation (Linux)
Bug description 🐛
With the PyTorch engine (top-down: detector + pose), deeplabcut.analyze_videos crashes with OverflowError: cannot convert float infinity to integer when a video produces no detections on any frame, so the predictions list is empty.
In _generate_output_data, the key width is computed as:
deeplabcut/pose_estimation_pytorch/apis/videos.py (v3.0.0rc13, line 903)
str_width = int(np.ceil(np.log10(len(predictions))))
When len(predictions) == 0, np.log10(0) = -inf and int(np.ceil(-inf)) raises OverflowError, aborting the whole analyze_videos call.
This happens legitimately whenever a clip contains no animal the detector recognizes (e.g. a setup/handling segment recorded before the actual trial). The empty-predictions condition is even detected just upstream, in video_inference:
same file, ~lines 232-240
if shelf_writer is None and len(predictions) != n_frames:
logging.warning(
f"The video metadata indicates that there {n_frames} in the video, but "
f"only {len(predictions)} were able to be processed. This can happen if "
"the video is corrupted. ..."
)
…but it is only warned about, not guarded against downstream, so the run still crashes.
Steps To Reproduce
Relevant log output
Anything else?
Even though the error is not that problematic since it is triggered by videos with no mouse that could or should be skipped, the current warning is misleading and points at video corruption.
Code of Conduct