Visitar URL original
Refactor VideoProcessor class by C-Achard · Pull Request #3358 · DeepLabCut/DeepLabCut · GitHub
Skip to content
Merged
Changes from 1 commit
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
3e47c96
Sort and stringify video list
C-Achard Jun 5, 2026
108beba
Convert video paths to strings for vp calls
C-Achard Jun 5, 2026
257a8c9
Revert "Sort and stringify video list"
C-Achard Jun 9, 2026
902aa1d
Add tests for VideoProcessorCV
C-Achard Jun 9, 2026
d3ed1b4
Turn VideoProcessor into ABC with abstract methods
C-Achard Jun 9, 2026
bffcb92
Use clip properties for height/width/fps
C-Achard Jun 9, 2026
f338f3c
Add properties and docs to video processor
C-Achard Jun 9, 2026
f18d166
Avoid str() casts when calling vp
C-Achard Jun 9, 2026
31f8985
Initialize video attrs and switch to logging
C-Achard Jun 9, 2026
203b131
Change logging to exception
C-Achard Jun 9, 2026
ef1d2e2
Test VideoProcessorCV accepts Path and stores str
C-Achard Jun 9, 2026
f0d4fd4
Add type annotations to VideoProcessor.__init__
C-Achard Jun 9, 2026
17de1f4
Address review comments
C-Achard Jun 10, 2026
09dd8b4
Refactor VideoProcessor API to video_fps/h/w
C-Achard Jun 10, 2026
5e24647
Mark legacy VideoProcessor accessors as deprecated
C-Achard Jun 10, 2026
84c60a2
Disable deprecated decorator on FPS property
C-Achard Jun 10, 2026
df89520
Comment on deprecations
C-Achard Jun 10, 2026
fbb6352
Fix incorrect property usage
C-Achard Jun 10, 2026
f07ba9e
Rename VideoProcessor.video_fps to fps
C-Achard Jun 11, 2026
06a7521
Rename VideoProcessor h/w to height/width
C-Achard Jun 12, 2026
8e86e02
Fix missing renaming of properties in make_labeled_video
C-Achard Jun 15, 2026
1496ff2
Merge branch 'main' into cy/fix-video-reader-set-error
MMathisLab Jun 25, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Initialize video attrs and switch to logging
In deeplabcut/utils/video_processor.py initialize commonly used instance attributes (FPS, vid, svid, sh, sw) in the constructor to avoid missing-attribute errors. Replace a stray print() in the exception handler with a module logger and add logging import/logger setup. Also add a brief note about FPS handling to clarify behavior when overriding video FPS.
  • Loading branch information
C-Achard committed Jun 9, 2026
commit 31f89858c60e2964dd613045ba8d87ea157ed8d4
12 changes: 11 additions & 1 deletion deeplabcut/utils/video_processor.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,14 @@
i.e. 'XVID'
"""

import logging
from abc import ABC, abstractmethod

import cv2
import numpy as np

logger = logging.getLogger(__name__)


class VideoProcessor(ABC):
"""Base class for a video processing unit, implementation is required for video
Expand All @@ -37,6 +40,11 @@ class VideoProcessor(ABC):
def __init__(self, fname="", sname="", nframes=-1, fps=None, codec="X264", sh="", sw=""):
self._fname = None
self._sname = None
self.FPS = None
self.vid = None
self.svid = None
self.sh = 0
self.sw = 0
###
Comment thread
C-Achard marked this conversation as resolved.
Resolved
Comment thread
C-Achard marked this conversation as resolved.
Resolved
self.fname = fname
Comment thread
C-Achard marked this conversation as resolved.
Resolved
self.sname = sname
Expand All @@ -63,9 +71,11 @@ def __init__(self, fname="", sname="", nframes=-1, fps=None, codec="X264", sh=""
self.svid = self.create_video()

except Exception as ex:
print("Error: %s", ex)
logger.error("VideoProcessor initialization failed: %s", ex)
Comment thread
C-Achard marked this conversation as resolved.
Resolved

if fps is not None: # Overwrite the video's FPS
# NOTE @C-Achard 2026-06-09 improving checks here might break old API
# same for raising on missing FPS
self.FPS = fps

def load_frame(self):
Expand Down
Loading