I am new in this field. I am using YOLOv5 for custom object detection. It is successfully implemented. Now, I further want to use the output of YOLOv5 for another input. Actually, I want to make program which will speak to wear mask if the person has not put on the mask. The classes are: 'with_mask' and 'without_mask'. I do not have any idea how to do this. Please help me with this.
Asked
Active
Viewed 607 times
1 Answers
0
I don't know how you implemented YOLOv5 so you have to check the part with pred
by yourself...
from gtts import gTTS
import os
mytext = 'Pls wear mask'
language = 'en'
myobj = gTTS(text=mytext, lang=language, slow=False)
myobj.save("mask.mp3")
if pred["label"] == "without_mask":
os.system("mpg321 mask.mp3")

Alexander Riedel
- 1,329
- 1
- 7
- 14
-
Thank you for your reply. However, I am not quite sure how and where should I use the code you provided. I used the YOLOv5 model given by ultralytics and trained it for custom dataset. I did not make any other changes. So, in which part of detect.py file should I use this code? Thank you in advance – Sharma IP Sep 29 '21 at 00:40