Spaces:
Running
on
Zero
Running
on
Zero
Update main.py
Browse files
main.py
CHANGED
@@ -10,7 +10,7 @@ from datetime import datetime
|
|
10 |
# Constants
|
11 |
TEST_MODE_DURATION = 3 # Process only first 3 seconds in test mode
|
12 |
FFMPEG_PRESETS = ['ultrafast', 'superfast', 'veryfast', 'faster', 'fast', 'medium', 'slow', 'slower', 'veryslow']
|
13 |
-
FONT = cv2.FONT_HERSHEY_SIMPLEX # Font for
|
14 |
|
15 |
# Detection parameters
|
16 |
IOU_THRESHOLD = 0.5 # IoU threshold for considering boxes related
|
@@ -296,7 +296,7 @@ def draw_ad_boxes(frame, detected_objects, detect_keyword, box_style='censor'):
|
|
296 |
frame: The video frame to draw on
|
297 |
detected_objects: List of (box, keyword) tuples
|
298 |
detect_keyword: The detection keyword
|
299 |
-
box_style: Visualization style ('censor', '
|
300 |
"""
|
301 |
height, width = frame.shape[:2]
|
302 |
|
@@ -319,7 +319,7 @@ def draw_ad_boxes(frame, detected_objects, detect_keyword, box_style='censor'):
|
|
319 |
if box_style == 'censor':
|
320 |
# Draw solid black rectangle
|
321 |
cv2.rectangle(frame, (x1, y1), (x2, y2), (0, 0, 0), -1)
|
322 |
-
elif box_style == '
|
323 |
# Draw red rectangle with thicker line
|
324 |
cv2.rectangle(frame, (x1, y1), (x2, y2), (0, 0, 255), 3)
|
325 |
|
@@ -541,7 +541,7 @@ def main():
|
|
541 |
help='Number of rows to split each frame into (default: 1)')
|
542 |
parser.add_argument('--cols', type=int, default=1,
|
543 |
help='Number of columns to split each frame into (default: 1)')
|
544 |
-
parser.add_argument('--box-style', choices=['censor', '
|
545 |
help='Style of detection visualization (default: censor)')
|
546 |
args = parser.parse_args()
|
547 |
|
|
|
10 |
# Constants
|
11 |
TEST_MODE_DURATION = 3 # Process only first 3 seconds in test mode
|
12 |
FFMPEG_PRESETS = ['ultrafast', 'superfast', 'veryfast', 'faster', 'fast', 'medium', 'slow', 'slower', 'veryslow']
|
13 |
+
FONT = cv2.FONT_HERSHEY_SIMPLEX # Font for bounding-box-style labels
|
14 |
|
15 |
# Detection parameters
|
16 |
IOU_THRESHOLD = 0.5 # IoU threshold for considering boxes related
|
|
|
296 |
frame: The video frame to draw on
|
297 |
detected_objects: List of (box, keyword) tuples
|
298 |
detect_keyword: The detection keyword
|
299 |
+
box_style: Visualization style ('censor', 'bounding-box', or 'hitmarker')
|
300 |
"""
|
301 |
height, width = frame.shape[:2]
|
302 |
|
|
|
319 |
if box_style == 'censor':
|
320 |
# Draw solid black rectangle
|
321 |
cv2.rectangle(frame, (x1, y1), (x2, y2), (0, 0, 0), -1)
|
322 |
+
elif box_style == 'bounding-box':
|
323 |
# Draw red rectangle with thicker line
|
324 |
cv2.rectangle(frame, (x1, y1), (x2, y2), (0, 0, 255), 3)
|
325 |
|
|
|
541 |
help='Number of rows to split each frame into (default: 1)')
|
542 |
parser.add_argument('--cols', type=int, default=1,
|
543 |
help='Number of columns to split each frame into (default: 1)')
|
544 |
+
parser.add_argument('--box-style', choices=['censor', 'bounding-box', 'hitmarker'], default='censor',
|
545 |
help='Style of detection visualization (default: censor)')
|
546 |
args = parser.parse_args()
|
547 |
|