Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

analyze_videos (PyTorch): OverflowError in _generate_output_data when a video yields zero detections (empty predictions)

Abierto
#3,485 1 comentario 0 reacciones 1 asignado Ver en GitHub

@deruyter92 ya está trabajando en esto.

Desde el 8/9/2026.

Evaluación

Este issue todavía no se ha evaluado.

Descripción

bug pytorch
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
  1. A top-down PyTorch project (e.g. fasterrcnn_mobilenet_v3_large_fpn detector + HRNet pose).
  2. Run deeplabcut.analyze_videos(config, [video], shuffle=N) on a video in which the animal is absent (or simply never detected).
  3. 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
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

Abrir la guía de contribución

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de DeepLabCut/DeepLabCut

Todos los issues de DeepLabCut/DeepLabCut

Issues similares

Más issues de Python

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.