Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions detect.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
import sys
from pathlib import Path

import pyttsx3
import torch

FILE = Path(__file__).resolve()
Expand Down Expand Up @@ -310,6 +311,15 @@ def write_to_csv(image_name, prediction, confidence):
# Print time (inference-only)
LOGGER.info(f"{s}{'' if len(det) else '(no detections), '}{dt[1].dt * 1E3:.1f}ms")

if s.startswith("0"):
engine = pyttsx3.init()
engine.say(f"{s.split (':') [1][8:]}") # Convert label to speech
engine.runAndWait()
else:
engine = pyttsx3.init()
engine.say(f"{s.split (':') [2][8:]}")
engine.runAndWait()

# Print results
t = tuple(x.t / seen * 1e3 for x in dt) # speeds per image
LOGGER.info(f"Speed: %.1fms pre-process, %.1fms inference, %.1fms NMS per image at shape {(1, 3, *imgsz)}" % t)
Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
# Usage: pip install -r requirements.txt

# Base ------------------------------------------------------------------------
pyttsx3
gitpython>=3.1.30
matplotlib>=3.3
numpy>=1.23.5
Expand Down
Loading