analyze_videos (PyTorch): OverflowError in _generate_output_data when a video yields zero detections (empty predictions)
@deruyter92 ya está trabajando en esto.
Desde el 8/9/2026.
Evaluación
Este issue todavía no se ha evaluado.
Descripción
Is there an existing issue for this?
- I have searched the existing issues
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
- I agree to follow this project's Code of Conduct
- Lenguaje dominante
- Python
- Estrellas
- 5.8k
- Forks
- 1.8k
- Merge medio
- 3 d 18 h
- PR fusionados (30 d)
- 29
Guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de DeepLabCut/DeepLabCut
-
napari-dlc
DeepLabCut/DeepLabCut#3524 · 1 comentario · 1 asignado ·
-
Metric path consistency for top-down, and safer snapshot selection when a metric is undefined Abiertoconfig enhancement metrics pytorch
DeepLabCut/DeepLabCut#3521 · 2 asignados ·
-
bug metrics pytorch
DeepLabCut/DeepLabCut#3518 · 1 comentario · 1 asignado ·
-
[Task] Improve CI workflows AbiertoCI enhancement
DeepLabCut/DeepLabCut#3517 · 1 comentario · 2 asignados ·
-
DeepLabCut/DeepLabCut#3493 · 1 asignado ·
Todos los issues de DeepLabCut/DeepLabCut
Issues similares
-
essnmx good first issue
Dificultad 1/5 Menos de una hora Aptitud para principiantes 95/100
-
[Feature] 奇物选择添加优先级 Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 65/100
syfoud/Simulated_Scepter#174 ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
Giskard-AI/giskard-oss#2840 · 1 comentario ·
-
A claim comment carrying the issue number is silently declined while the workflow reports success Abiertoarea: repo bug perceived difficulty: 2
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
yeti-platform/yeti#1380 ·