diff --git a/crabs/tracker/track_video.py b/crabs/tracker/track_video.py index 81ad2cef..7ffeb7d0 100644 --- a/crabs/tracker/track_video.py +++ b/crabs/tracker/track_video.py @@ -232,6 +232,13 @@ def core_detection_and_tracking(self): # Loop over frames frame_idx = 0 while input_video_object.isOpened(): + # Break if beyond end frame (mostly for debugging) + if ( + self.args.max_frames_to_read + and frame_idx + 1 > self.args.max_frames_to_read + ): + break + # Read frame ret, frame = input_video_object.read() if not ret: