Future-Tense commited on
Commit
e165b9e
·
1 Parent(s): 6d305e1

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -8
app.py CHANGED
@@ -6,6 +6,13 @@ from pytube import YouTube
6
  from ultralyticsplus import YOLO, render_result
7
 
8
  #from torch import hub # Hub contains other models like FasterRCNN
 
 
 
 
 
 
 
9
 
10
  URL = "https://www.youtube.com/watch?v=dQw4w9WgXcQ" #URL to parse
11
  #play = pafy.new(_URL).streams[-1] #'-1' means read the lowest quality of video.
@@ -19,14 +26,7 @@ class Capvid:
19
 
20
 
21
  # load model
22
- model = YOLO('ultralyticsplus/yolov8s')
23
-
24
- # set model parameters
25
- model.overrides['conf'] = 0.25 # NMS confidence threshold
26
- model.overrides['iou'] = 0.45 # NMS IoU threshold
27
- model.overrides['agnostic_nms'] = False # NMS class-agnostic
28
- model.overrides['max_det'] = 1000 # maximum number of detections per image
29
-
30
  # set image
31
  #image = 'https://github.com/ultralytics/yolov5/raw/master/data/images/zidane.jpg'
32
 
@@ -102,6 +102,7 @@ class Capvid:
102
  print(f"Frames Per Second : {fps}")
103
  out.write(frame) # Write the frame onto the output.
104
  ret, frame = player.read() # Read next frame.
 
105
 
106
  def vid_play():
107
  Capvid()
 
6
  from ultralyticsplus import YOLO, render_result
7
 
8
  #from torch import hub # Hub contains other models like FasterRCNN
9
+ model = YOLO('ultralyticsplus/yolov8s')
10
+
11
+ # set model parameters
12
+ model.overrides['conf'] = 0.25 # NMS confidence threshold
13
+ model.overrides['iou'] = 0.45 # NMS IoU threshold
14
+ model.overrides['agnostic_nms'] = False # NMS class-agnostic
15
+ model.overrides['max_det'] = 1000 # maximum number of detections per image
16
 
17
  URL = "https://www.youtube.com/watch?v=dQw4w9WgXcQ" #URL to parse
18
  #play = pafy.new(_URL).streams[-1] #'-1' means read the lowest quality of video.
 
26
 
27
 
28
  # load model
29
+
 
 
 
 
 
 
 
30
  # set image
31
  #image = 'https://github.com/ultralytics/yolov5/raw/master/data/images/zidane.jpg'
32
 
 
102
  print(f"Frames Per Second : {fps}")
103
  out.write(frame) # Write the frame onto the output.
104
  ret, frame = player.read() # Read next frame.
105
+ return frame
106
 
107
  def vid_play():
108
  Capvid()