Update app.py
Browse files
app.py
CHANGED
|
@@ -14,12 +14,17 @@ model.agnostic = False
|
|
| 14 |
model.multi_label = False
|
| 15 |
model.max_det = 100 # max number of detections
|
| 16 |
|
| 17 |
-
# Low-resolution for inference
|
| 18 |
-
|
|
|
|
| 19 |
|
| 20 |
#Faster inference but less accurate
|
| 21 |
#LOW_RES = (320, 180)
|
| 22 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 23 |
def detect_and_draw(frame):
|
| 24 |
# Create low-res copy
|
| 25 |
low_res_frame = cv2.resize(frame, LOW_RES)
|
|
@@ -42,7 +47,11 @@ def detect_and_draw(frame):
|
|
| 42 |
return frame
|
| 43 |
|
| 44 |
# Define your stream URL
|
| 45 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 46 |
|
| 47 |
#stream_url = "https://edge01.london.nginx.hdontap.com/hosb1/julian-coc.stream/chunklist_w1106429103.m3u8"
|
| 48 |
#stream_url = "https://edge01.london.nginx.hdontap.com/hosb5/ng_showcase-coke_bottle-street_fixed.stream/chunklist_w464099566.m3u8"
|
|
@@ -55,7 +64,7 @@ def process_stream():
|
|
| 55 |
if not ret:
|
| 56 |
break
|
| 57 |
|
| 58 |
-
frame_count += 3
|
| 59 |
if frame_count % 30 == 0:
|
| 60 |
result = detect_and_draw(frame)
|
| 61 |
result_rgb = cv2.cvtColor(result, cv2.COLOR_BGR2RGB)
|
|
|
|
| 14 |
model.multi_label = False
|
| 15 |
model.max_det = 100 # max number of detections
|
| 16 |
|
| 17 |
+
# Low-resolution for inference
|
| 18 |
+
#Keswick cam frame_count += 3
|
| 19 |
+
#LOW_RES = (500, 600)
|
| 20 |
|
| 21 |
#Faster inference but less accurate
|
| 22 |
#LOW_RES = (320, 180)
|
| 23 |
|
| 24 |
+
#Fastest inference but low accuracy, change the frame_count += 2
|
| 25 |
+
LOW_RES = (300, 300)
|
| 26 |
+
|
| 27 |
+
|
| 28 |
def detect_and_draw(frame):
|
| 29 |
# Create low-res copy
|
| 30 |
low_res_frame = cv2.resize(frame, LOW_RES)
|
|
|
|
| 47 |
return frame
|
| 48 |
|
| 49 |
# Define your stream URL
|
| 50 |
+
|
| 51 |
+
stream_url = "https://2-fss-2.streamhoster.com/pl_126/200612-2266250-1/chunklist.m3u8"
|
| 52 |
+
|
| 53 |
+
#keswick
|
| 54 |
+
#stream_url = "https://view.h264.cam/ref/kta/live.primary.m3u8"
|
| 55 |
|
| 56 |
#stream_url = "https://edge01.london.nginx.hdontap.com/hosb1/julian-coc.stream/chunklist_w1106429103.m3u8"
|
| 57 |
#stream_url = "https://edge01.london.nginx.hdontap.com/hosb5/ng_showcase-coke_bottle-street_fixed.stream/chunklist_w464099566.m3u8"
|
|
|
|
| 64 |
if not ret:
|
| 65 |
break
|
| 66 |
|
| 67 |
+
frame_count += 2 #change to 3 for higher res
|
| 68 |
if frame_count % 30 == 0:
|
| 69 |
result = detect_and_draw(frame)
|
| 70 |
result_rgb = cv2.cvtColor(result, cv2.COLOR_BGR2RGB)
|