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

Method get_fn

slowfast/visualization/demo_loader.py:295–323  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

293 return was_read, task
294
295 def get_fn(self):
296 while not self.stopped:
297 with self.put_id_lock:
298 put_id = self.put_id
299 not_end = self.not_end
300
301 with self.write_lock:
302 # If video ended and we have display all frames.
303 if not not_end and self.get_id == put_id:
304 break
305 # If the next frames are not available, wait.
306 if (
307 len(self.write_queue) == 0
308 or self.write_queue.get(self.get_id + 1) is None
309 ):
310 time.sleep(0.02)
311 continue
312 else:
313 self.get_id += 1
314 was_read, task = self.write_queue[self.get_id]
315 del self.write_queue[self.get_id]
316
317 with self.output_lock:
318 for frame in task.frames[task.num_buffer_frames :]:
319 if self.output_file is None:
320 cv2.imshow("SlowFast", frame)
321 time.sleep(1 / self.output_fps)
322 else:
323 self.output_file.write(frame)
324
325 def display(self, task):
326 """

Callers

nothing calls this directly

Calls 1

getMethod · 0.45

Tested by

no test coverage detected