Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to realize the function of recognizing Voice broadcast by Python3.7 + Yolo3

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

This article will explain in detail how to realize the recognition voice broadcasting function of Python3.7 + Yolo3. The content of the article is of high quality, so the editor shares it for you as a reference. I hope you will have a certain understanding of the relevant knowledge after reading this article.

First, use Python to call the text to voice of the system win10.

First download the library you need: pip install pyttsx3-I https://mirrors.aliyun.com/pypi/simple/

Then go directly to the code:

The import win32com.client as win# SpVoice class is the core class that supports speech synthesis (TTS). The TTS engine is called through the SpVoice object, thus realizing the reading function speak = win.Dispatch ("SAPI.SpVoice") # to convert the text information into speech and read aloud according to the specified parameters. # this method has two parameters, Text and Flags, which specify the text to be read aloud and the reading method (synchronous or asynchronous, etc.). Speak.Speak ("come on") speak.Speak ("Hello")

Finally, when you run the code, you will hear the sound from the system and read out come on and Hello.

Second, start to use Yolo recognition and return it by voice broadcast

Before we start, we have to parse out the Yolo3 code so as to get the identified object tags.

First of all, we found a coco_classes.txt, found that there are a lot of English words, these are ready to identify matching tags.

Then we found yolo.py, and our coco_classes.txt that we found was passed in.

The key point is that we searched the classes_path Key through Ctrl + F and found these lines of code.

Here is the text in which the tag is stored, processed, and the name returned.

Finally, we find this line of code, which is the code printed by our console at the beginning of the recognition.

When running the code, it is found that the label printed is the label of the identified object.

At this time, we can add the code for our voice broadcast, put the label in, and we will find that the recognized object will be returned by voice.

About Python3.7 + Yolo3 how to achieve recognition voice broadcasting function to share here, I hope the above content can be of some help to you, can learn more knowledge. If you think the article is good, you can share it for more people to see.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report