aidas-79 commited on
Commit
0073c38
·
verified ·
1 Parent(s): af97fb5

Update video_detection.py

Browse files
Files changed (1) hide show
  1. video_detection.py +2 -1
video_detection.py CHANGED
@@ -31,6 +31,7 @@ def draw_boxes(frame, results):
31
 
32
  return frame
33
 
 
34
  def video_detection(cap):
35
  video_codec = cv2.VideoWriter_fourcc(*"mp4v") # type: ignore
36
  #video_codec = cv2.VideoWriter_fourcc(*'h264')
@@ -53,7 +54,7 @@ def video_detection(cap):
53
  if n_frames % SUBSAMPLE == 0:
54
  batch.append(frame)
55
  #if len(batch) == 2 * desired_fps:
56
- if len(batch) == 8:
57
  #inputs = image_processor(images=batch, return_tensors="pt").to("cuda")
58
 
59
  print(f"starting batch of size {len(batch)}")
 
31
 
32
  return frame
33
 
34
+ @spaces.GPU
35
  def video_detection(cap):
36
  video_codec = cv2.VideoWriter_fourcc(*"mp4v") # type: ignore
37
  #video_codec = cv2.VideoWriter_fourcc(*'h264')
 
54
  if n_frames % SUBSAMPLE == 0:
55
  batch.append(frame)
56
  #if len(batch) == 2 * desired_fps:
57
+ if len(batch) == 4:
58
  #inputs = image_processor(images=batch, return_tensors="pt").to("cuda")
59
 
60
  print(f"starting batch of size {len(batch)}")