当前位置: 首页 > news >正文

甘肃网站建设选哪家做宣传网站买什么云服务器

甘肃网站建设选哪家,做宣传网站买什么云服务器,网站建站建设价格,网站域名自己做使用pyannote-audio实现声纹分割聚类 # GitHub地址 https://github.com/MasonYyp/audio1 简单介绍 pyannote.audio是用Python编写的用于声纹分割聚类的开源工具包。在PyTorch机器学习基础上#xff0c;不仅可以借助性能优越的预训练模型和管道实现声纹分割聚类#xff0c;还…使用pyannote-audio实现声纹分割聚类 # GitHub地址 https://github.com/MasonYyp/audio1 简单介绍 pyannote.audio是用Python编写的用于声纹分割聚类的开源工具包。在PyTorch机器学习基础上不仅可以借助性能优越的预训练模型和管道实现声纹分割聚类还可以进一步微调模型。 它的主要功能有以下几个 声纹嵌入从一段声音中提出声纹转换为向量嵌入声纹识别从一段声音中识别不同的人多个人声纹活动检测检测一段声音检测不同时间点的活动声纹重叠检测检测一段声音中重叠交叉的部分声纹分割将一段声音进行分割 pyannote.audio中主要有”segmentation“、”embedding“和”speaker-diarization“三个模型”segmentation“的主要作用是分割、”embedding“主要作用是嵌入跟wespeaker-voxceleb-resnet34-LM作用相同”speaker-diarization“的作用是使用管道对上面两个模型整合。 pyannote-audio的参考地址 # Huggingface地址 https://hf-mirror.com/pyannote# Github地址 https://github.com/pyannote/pyannote-audio⚠️ 注意 pyannote.audio不同的版本有些区别 2 使用pyannote.audio:3.1.3 2.1 安装pyannote.audio pip install pyannote.audio3.1.1 -i https://pypi.tuna.tsinghua.edu.cn/simple使用模型需要现在huggingface上下载模型模型如下 ⚠️ pyannote.audio的部分模型是收到保护的即需要在huggingface登录后填写部分信息同意相关协议才能下载否则无法下载。 # 1 嵌入模型 pyannote/wespeaker-voxceleb-resnet34-LM https://hf-mirror.com/pyannote/wespeaker-voxceleb-resnet34-LM# 2 分割模型 pyannote/segmentation-3.0 https://hf-mirror.com/pyannote/segmentation-3.0使用huggingface-cli下载相关模型的命令 # 注意需要先创建Python环境# 安装huggingface-cli pip install -U huggingface_hub# 例如下载pyannote/embedding模型 # 必须提供Hugging上的 --token hf_**** huggingface-cli download --resume-download pyannote/embedding --local-dir pyannote/embedding --local-dir-use-symlinks False --token hf_****注意两个类 # Inference主要用于声纹嵌入 pyannote.audio import Inference# Annotation主要用于声纹分割 from pyannote.core import Annotation# Annotation中的主要方法假设实例为diarization # 获取声音中说话人的标识 labels diarization.labels()# 获取声音中全部的活动Segment列表 segments list(diarization.itertracks())# 获取声音中指定说话人时间段列表”SPEAKER_00“为第一个说话人的标识 durations diarization.label_timeline(SPEAKER_00)2.2 实现声纹分割 注意pyannote/speaker-diarization-3.1实现声纹识别特别慢不知道是不是我的方法不对30分钟的音频处理了20多分钟。⚠️ 使用单个模型很快。pyannote/speaker-diarization版本2较快推荐使用pyannote/speaker-diarization版本2。 注意此处加载模型和通常加载模型的思路不同常规加载模型直接到名称即可此处需要加载到具体的模型名称。 1使用python方法 # 使用 pyannote-audio-3.1.1 import timefrom pyannote.audio import Model from pyannote.audio.pipelines import SpeakerDiarization from pyannote.audio.pipelines.utils import PipelineModel from pyannote.core import Annotation# 语音转向量模型 embedding: PipelineModel Model.from_pretrained(E:/model/pyannote/pyannote-audio-3.1.1/wespeaker-voxceleb-resnet34-LM/pytorch_model.bin) # 分割语音模型 segmentation: PipelineModel Model.from_pretrained(E:/model/pyannote/pyannote-audio-3.1.1/segmentation-3.0/pytorch_model.bin)# 语音分离模型 speaker_diarization: SpeakerDiarization SpeakerDiarization(segmentationsegmentation, embeddingembedding)# 初始化语音分离模型的参数 HYPER_PARAMETERS {clustering: {method: centroid,min_cluster_size: 12,threshold: 0.7045654963945799},segmentation:{min_duration_off: 0.58} } speaker_diarization.instantiate(HYPER_PARAMETERS)start_time time.time()# 分离语音 diarization: Annotation speaker_diarization(E:/语音识别/数据/0-test-en.wav)# 获取说话人列表 print(diarization.labels()) # 获取活动segments列表 print(list(diarization.itertracks())) print(diarization.label_timeline(SPEAKER_00))ent_time time.time() print(ent_time - start_time)2使用yml方法 # instantiate the pipeline from pyannote.audio import Pipeline from pyannote.core import Annotationspeaker_diarization Pipeline.from_pretrained(E:/model/pyannote/speaker-diarization-3.1/config.yaml)# 分离语音 diarization: Annotation speaker_diarization(E:/语音识别/数据/0-test-en.wav)print(type(diarization)) print(diarization.labels())config.yaml 根据文件可以看出声纹分割是将embedding和segmentation进行了组合。 version: 3.1.0pipeline:name: pyannote.audio.pipelines.SpeakerDiarizationparams:clustering: AgglomerativeClustering# embedding: pyannote/wespeaker-voxceleb-resnet34-LMembedding: E:/model/pyannote/speaker-diarization-3.1/wespeaker-voxceleb-resnet34-LM/pytorch_model.binembedding_batch_size: 32embedding_exclude_overlap: true# segmentation: pyannote/segmentation-3.0segmentation: E:/model/pyannote/speaker-diarization-3.1/segmentation-3.0/pytorch_model.binsegmentation_batch_size: 32params:clustering:method: centroidmin_cluster_size: 12threshold: 0.7045654963945799segmentation:min_duration_off: 0.0模型目录 模型中的其他文件可以删除只保留”pytorch_model.bin“即可。 执行结果 2.3 实现声纹识别 比较两段声音的相似度。 from pyannote.audio import Model from pyannote.audio import Inference from scipy.spatial.distance import cdist# 导入模型 embedding Model.from_pretrained(E:/model/pyannote/speaker-diarization-3.1/wespeaker-voxceleb-resnet34-LM/pytorch_model.bin)# 抽取声纹 inference: Inference Inference(embedding, windowwhole)# 生成声纹1维向量 embedding1 inference(E:/语音识别/数据/0-test-en.wav) embedding2 inference(E:/语音识别/数据/0-test-en.wav)# 计算两个声纹的相似度 distance cdist([embedding1], [embedding2], metriccosine) print(distance)2.4 检测声纹活动 from pyannote.audio import Model from pyannote.core import Annotation from pyannote.audio.pipelines import VoiceActivityDetection# 加载模型 model Model.from_pretrained(E:/model/pyannote/speaker-diarization-3.1/segmentation-3.0/pytorch_model.bin)# 初始化参数 activity_detection VoiceActivityDetection(segmentationmodel) HYPER_PARAMETERS {# remove speech regions shorter than that many seconds.min_duration_on: 1,# fill non-speech regions shorter than that many seconds.min_duration_off: 0 } activity_detection.instantiate(HYPER_PARAMETERS)# 获取活动特征 annotation: Annotation activity_detection(E:/语音识别/数据/0-test-en.wav)# 获取活动列表 segments list(annotation.itertracks()) print(segments)3 使用pyannote.audio:2.1.1 ⚠️ 推荐使用此版本 3.1 安装pyannote.audio # 安装包 pip install pyannote.audio2.1.1 -i https://pypi.tuna.tsinghua.edu.cn/simple# 1 嵌入模型 pyannote/embedding https://hf-mirror.com/pyannote/embedding# 2 分割模型 pyannote/segmentation https://hf-mirror.com/pyannote/segmentation3.2 实现声纹分割 # 使用 pyannote-audio-2.1.1 import timefrom pyannote.audio.pipelines import SpeakerDiarization from pyannote.audio import Model from pyannote.audio.pipelines.utils import PipelineModel from pyannote.core import Annotation# 语音转向量模型 embedding: PipelineModel Model.from_pretrained(E:/model/pyannote/pyannote-audio-2.1.1/embedding/pytorch_model.bin)# 分割语音模型 segmentation: PipelineModel Model.from_pretrained(E:/model/pyannote/pyannote-audio-2.1.1/segmentation/pytorch_model.bin)# 语音分离模型 speaker_diarization: SpeakerDiarization SpeakerDiarization(segmentationsegmentation,embeddingembedding,clusteringAgglomerativeClustering )HYPER_PARAMETERS {clustering: {method: centroid,min_cluster_size: 15,threshold: 0.7153814381597874},segmentation:{min_duration_off: 0.5817029604921046,threshold: 0.4442333667381752} }speaker_diarization.instantiate(HYPER_PARAMETERS)start_time time.time() # vad: Annotation pipeline(E:/语音识别/数据/0-test-en.wav) diarization: Annotation speaker_diarization(E:/语音识别/数据/0-test-en.wav)# 获取说话人列表 print(diarization.labels())ent_time time.time() print(ent_time - start_time)3.3 其他功能 3.1.1版本的功能2.1.1都能实现参考3.1.1版本即可。
http://www.w-s-a.com/news/589924/

相关文章:

  • 怎么利用代码做网站重庆网络营销网站建设销售
  • 用dw怎么做网站留言板百度举报网站
  • 成都微网站设计企业为什么要做网络营销推广
  • 双桥区网站制作企业网站一般内容包括哪些
  • 莆田外贸专业建站做app 需要先做网站吗
  • 网站怎么用北京口碑最好的装修公司
  • 潮州网站建设深圳微信分销网站设计
  • asp.net网站开发实例教程pdf泉州seo网站关键词优推广
  • 怎样建立一个企业网站dede 网站名称
  • 做网上竞彩网站合法吗免费网站建设品牌
  • 网站开发所需要的的环境客户关系管理的内涵
  • 优质做网站公司做软件的人叫什么
  • 徐州市徐州市城乡建设局网站首页网站建设刂金手指下拉十五
  • 建设游戏网站目的及其定位市场营销策略概念
  • 小学电教检查网站建设资料wordpress谷歌字体
  • 南通做网站的公司有哪些中国建筑论坛网
  • 技术支持 佛山网站建设wordpress不用ftp
  • 广州定制app开发wordpress配置搜索引擎优化
  • 兰州网站建设论坛四川建设网官网登录
  • 在线作图免费网站湖南批量出品机
  • 深圳做网站公司有哪些地方妇联加强网站平台建设
  • vps建设网站别人访问不了网页链接生成器
  • 网站建设一般要多少钱电商平台取名字大全
  • 怎么做网站封面上的图网站开发语言 微信接口
  • 免费观看网站建设优化安徽
  • 上海电商网站开发公司做婚恋网站的翻译好吗
  • 以网站建设为开题报告大数据技术就业前景
  • dw做网站字体 别人电脑显示青岛活动策划公司
  • 网站成立时间查询墨猴seo排名公司
  • 技术支持 随州网站建设苏州企业网站建设定制