MCPcopy Create free account
hub / github.com/OpenGVLab/UniFormerV2 / __next__

Method __next__

slowfast/visualization/demo_loader.py:70–98  ·  view source on GitHub ↗

Read and return the required number of frames for 1 clip. Returns: was_read (bool): False if not enough frames to return. task (TaskInfo object): object contains metadata for the current clips.

(self)

Source from the content-addressed store, hash-verified

68 return self
69
70 def __next__(self):
71 """
72 Read and return the required number of frames for 1 clip.
73 Returns:
74 was_read (bool): False if not enough frames to return.
75 task (TaskInfo object): object contains metadata for the current clips.
76 """
77 self.id += 1
78 task = TaskInfo()
79
80 task.img_height = self.display_height
81 task.img_width = self.display_width
82 task.crop_size = self.test_crop_size
83 task.clip_vis_size = self.clip_vis_size
84
85 frames = []
86 if len(self.buffer) != 0:
87 frames = self.buffer
88 was_read = True
89 while was_read and len(frames) < self.seq_length:
90 was_read, frame = self.cap.read()
91 frames.append(frame)
92 if was_read and self.buffer_size != 0:
93 self.buffer = frames[-self.buffer_size :]
94
95 task.add_frames(self.id, frames)
96 task.num_buffer_frames = 0 if self.id == 0 else self.buffer_size
97
98 return was_read, task
99
100 def get_output_file(self, path, fps=30):
101 """

Callers

nothing calls this directly

Calls 2

add_framesMethod · 0.95
TaskInfoClass · 0.90

Tested by

no test coverage detected