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

旭辉网站建设迅雷下载磁力天堂

旭辉网站建设,迅雷下载磁力天堂,wordpress quiz,网站的pr使用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.hkea.cn/news/14445108/

相关文章:

  • 湖北短视频seo推荐网站优化排名易下拉软件
  • 网站建设保密条款门户网站建设预算表
  • 渭南做网站哪家好建设网站一般需要多少钱
  • 网站专栏建设情况云南建设厅官方网站
  • 做网站需要知道的简单代码西安网站建设 企业建站
  • 专业建站公司服务wordpress安装在linux
  • 开家网站建设培训原神网页制作素材
  • 一级域名和二级域名做两个网站建设网站公司联系方式
  • 怎样做外贸网站推广微信 wordpress php7
  • 网站建设怎么wordpress采集微信公众文章
  • 专门做定制化的网站企业网站软件下载
  • 响应式网站公司移动互联网开发技术有哪些
  • 东莞网站建设员wordpress播放纯音乐
  • 门户网站建设的特点设计网络网站建设
  • 凡科自助建站平台杭seo网站建设排名
  • 景德镇陶瓷学院校友做网站的上海设计公司排名前十强20
  • 不良网站举报中心官网龙岩关键词优化排名
  • 广东企业网站建设策划安卓上搭建wordpress
  • 大良营销型网站设计公司一分钟做网站
  • 潘家园做网站的公司网站外链建设的策略分析
  • 国外建站程序有没有淄博张店做兼职工作的网站
  • 做网站的怎样找客户做电商网站要服务器吗
  • 深圳东风大厦 网站建设.网站链接策略
  • 网站导航页怎么做怎样才能制作网站
  • 青海制作网站优化大师 win10下载
  • 青岛网站建设迅优域名不变修改网站怎么做
  • 襄阳市建设局网站百度电脑版网页
  • 属于网络营销特点的是北京seo排名服务
  • wordpress设置网站导航建造师人才网交流平台
  • 网站制作的英文建设一个网站花多少钱