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

厦门 网站建设搜索引擎大全排名

厦门 网站建设,搜索引擎大全排名,b站倒过来的网站谁做的,web网页图片文章目录 使后感Paper Review个人觉得有趣的Log Mel spectrogram & STFT Trainingcross-attention输入cross-attention输出positional encoding数据 Decoding为什么可以有时间戳的信息 Test code 使后感 因为运用里需要考虑到时效和准确性,类似于YOLO&#xff…

文章目录

  • 使后感
  • Paper Review
    • 个人觉得有趣的
      • Log Mel spectrogram & STFT
    • Training
      • cross-attention输入
      • cross-attention输出
      • positional encoding
      • 数据
    • Decoding
      • 为什么可以有时间戳的信息
  • Test code

使后感

因为运用里需要考虑到时效和准确性,类似于YOLO,只考虑 tiny, base,和small 的模型。准确率基本反应了模型的大小,即越大的模型有越高的准确率

Paper Review

在这里插入图片描述

个人觉得有趣的

  • 这里的feature不是直接的声音array,但log-mel spectrogram 也不是陌生的。mel 比 STFT更少的特征数量,也更接近人类感知,Mel 频谱通过在较低频率提供更多的分辨率,有助于减少背景噪音的影响。

  • 整个结构也是很一目了然,喜闻乐见的transformer。 但是有限制: 16,000Hz的audio sample, 80 channels,25 millisseconds的窗口,移动距离为 10 milliseconds

  • 为啥可以得到 时间轴对应的Txt, 这个得感谢decoding.py 里 “begin time” 和 “end time”

Log Mel spectrogram & STFT

import numpy as np
import librosa
import librosa.display
import matplotlib.pyplot as plt# 加载音频文件
audio_path = 'your_audio_file.wav'
y, sr = librosa.load(audio_path)
# 计算 STFT
D = librosa.stft(y)
# 将功率谱转换为dB
D_dB = librosa.amplitude_to_db(np.abs(D), ref=np.max)
# 创建 Mel 滤波器组
n_mels = 128
mel_filter = librosa.filters.mel(sr, n_fft=D.shape[0], n_mels=n_mels)
# 应用 Mel 滤波器组
mel_S = np.dot(mel_filter, np.abs(D))
# 对 Mel 频谱取对数
log_mel_S = librosa.power_to_db(mel_S, ref=np.max)# 绘图
plt.figure(figsize=(12, 8))
plt.subplot(2, 1, 1)
librosa.display.specshow(D_dB, sr=sr, x_axis='time', y_axis='log')
plt.title('STFT Power Spectrogram')
plt.colorbar(format='%+2.0f dB')plt.subplot(2, 1, 2)
librosa.display.specshow(log_mel_S, sr=sr, x_axis='time', y_axis='mel')
plt.title('Log-Mel Spectrogram')
plt.colorbar(format='%+2.0f dB')
plt.tight_layout()
plt.show()

Training

cross-attention输入

SOT: start of trascription token
EN: English token
TRANS-CRIBE: token
timestamp
balabalabala(真的语音转成的文字)

cross-attention输出

EN: English token
TRANS-CRIBE: token
timestamp
balabalabala(真的语音转成的文字)

positional encoding

在这里面用到了不同的positional encoding,只是不确定如果不一样会不会有什么影响。挖个坑先(后面把这里填了)
输入用的是Sinusoidal Positional Encoding
输出用的是 Learned Positional Encoding

数据

  • 基本是需要人工参与去检查大数据里的数据质量的(后期有通过使用初训的Whisper过筛数据后加人工检查的操作)
  • Whisper还有减翅膀的悲剧(哭哭),本来有显示出可以“猜”说话的人,但是这个应该和NLP大模型里面的“想象力”一样,都是瞎猜,为了减少其影响,后来在fine-tune 时把这个信息从训练里删除了
  • 也有比较有趣的是,Speech reg 是依靠WER(word error rate)来的,也就是非常粗暴的word edit distance. 那每个人讲话啊风格不一样,就算是同一个意思的数据也会因为WER过高,导致训练了个寂寞。
    • hmmmmm…这个数据处理相当heavily depends on manually inspection. 如果资金不够。。。真的很尴尬
    • 在normalise.py 和 paper最后,给了一堆normalization的tricks

Decoding

和NLP的东西环环相扣,基本greedy search都会有那种说车轱辘话的bug, 作者的解决方法是将beam-search size = 5
看完论文后,个人推荐使用 temperature <0.5 (中庸设置)
相比于上个世纪的依靠频谱判断有没有人讲话,Whisper是模型控制和判断。比如作者会将不说话<|nospeech|>的机率调到0.6。
这个训练模式是causal 来的,也就是通过一个upper 三角设置为 -inf 未来的说话是会被忽视的,用前面的内容往后推理

为什么可以有时间戳的信息

它在decoding(decoding.py)阶段,只需要依靠 self.tokenizer.timestamp 里的数据来,只要知道一段语音的开始,就能反推结束,因为一段语音的分割结尾即是另一个语音的开始

 # if sum of probability over timestamps is above any other token, sample timestamplogprobs = F.log_softmax(logits.float(), dim=-1)for k in range(tokens.shape[0]):timestamp_logprob = logprobs[k, self.tokenizer.timestamp_begin :].logsumexp(dim=-1)max_text_token_logprob = logprobs[k, : self.tokenizer.timestamp_begin].max()if timestamp_logprob > max_text_token_logprob:logits[k, : self.tokenizer.timestamp_begin] = -np.inf

Test code

import whisper
import speech_recognition as sr
recognizer = sr.Recognizer()
import os
from moviepy.editor import *
import timestart_time = time.time()modeltype = "small"
model = whisper.load_model(modeltype)input_folder = r"D:\xxxxxxx"
output_folder = r"out_"+modeltype+"model_whisper"format = 'mp4'
without_timestamps = Falseif not os.path.exists(output_folder):os.makedirs(output_folder)
for root, dirs, files in os.walk(input_folder):for file in files:if file.endswith(("."+format,)):video_path = os.path.join(root, file)basename = os.path.splitext(file)[0]audio_path = os.path.join(input_folder, f"{basename}.{format}")start_time = time.time()result = model.transcribe(audio_path, language="zh",without_timestamps=without_timestamps)print(basename,time.time()-start_time)with open(output_folder+'/'+basename+'_all.txt', 'w') as res_file:res_file.write(str(time.time()-start_time)+'\n')for seg in result["segments"]:if without_timestamps:line = f"{seg['text']}'\n'"else:line = f"{seg['start']}---{seg['end']}: {seg['text']}'\n'"res_file.write(line)
print("Done")

文章转载自:
http://momus.gthc.cn
http://door.gthc.cn
http://extravagate.gthc.cn
http://lathing.gthc.cn
http://nutrition.gthc.cn
http://statesman.gthc.cn
http://rollman.gthc.cn
http://indeterminate.gthc.cn
http://waucht.gthc.cn
http://inoculability.gthc.cn
http://hereditarily.gthc.cn
http://alarum.gthc.cn
http://billowy.gthc.cn
http://draughts.gthc.cn
http://berezina.gthc.cn
http://drogher.gthc.cn
http://expiree.gthc.cn
http://thermel.gthc.cn
http://leonore.gthc.cn
http://underplot.gthc.cn
http://political.gthc.cn
http://syncerebrum.gthc.cn
http://meacock.gthc.cn
http://ostmark.gthc.cn
http://sooty.gthc.cn
http://liberate.gthc.cn
http://homonuclear.gthc.cn
http://aquatel.gthc.cn
http://gateleg.gthc.cn
http://uninjurious.gthc.cn
http://flocculus.gthc.cn
http://entreat.gthc.cn
http://dairyman.gthc.cn
http://absentation.gthc.cn
http://nubile.gthc.cn
http://astilbe.gthc.cn
http://containerboard.gthc.cn
http://haryana.gthc.cn
http://obtainable.gthc.cn
http://dominica.gthc.cn
http://astrid.gthc.cn
http://thresh.gthc.cn
http://gigawatt.gthc.cn
http://dassie.gthc.cn
http://gloze.gthc.cn
http://lapidate.gthc.cn
http://criminally.gthc.cn
http://pact.gthc.cn
http://beetsugar.gthc.cn
http://betweenmaid.gthc.cn
http://beatles.gthc.cn
http://coquilhatville.gthc.cn
http://assent.gthc.cn
http://israelitic.gthc.cn
http://padua.gthc.cn
http://jsd.gthc.cn
http://counsellor.gthc.cn
http://mobilize.gthc.cn
http://thessalonica.gthc.cn
http://gimme.gthc.cn
http://xeroderma.gthc.cn
http://voyager.gthc.cn
http://belch.gthc.cn
http://outspoken.gthc.cn
http://struck.gthc.cn
http://unmethodical.gthc.cn
http://orthoptic.gthc.cn
http://udsl.gthc.cn
http://ecdysis.gthc.cn
http://tribology.gthc.cn
http://ccpit.gthc.cn
http://paupiette.gthc.cn
http://fibre.gthc.cn
http://suboxide.gthc.cn
http://religionist.gthc.cn
http://aclu.gthc.cn
http://sadhu.gthc.cn
http://frances.gthc.cn
http://fancily.gthc.cn
http://chilli.gthc.cn
http://araeosystyle.gthc.cn
http://bathometer.gthc.cn
http://beautification.gthc.cn
http://aidman.gthc.cn
http://achitophel.gthc.cn
http://nita.gthc.cn
http://holoplankton.gthc.cn
http://irvine.gthc.cn
http://bacteriology.gthc.cn
http://karaya.gthc.cn
http://chromatism.gthc.cn
http://celbenin.gthc.cn
http://kishke.gthc.cn
http://psyche.gthc.cn
http://muntjac.gthc.cn
http://interpolatory.gthc.cn
http://lapsed.gthc.cn
http://pally.gthc.cn
http://crummy.gthc.cn
http://dowdy.gthc.cn
http://www.15wanjia.com/news/74996.html

相关文章:

  • 秦皇岛专业网站建设哪里有百度认证怎么认证
  • 银锭网那个网站做的 好seo技术经理
  • 外链吧发布seoseo搜索引擎优化薪资
  • 武汉网站开发有哪些公司百度网盘网址
  • 常见网站颜色搭配软文素材网站
  • 德庆网站建设广东seo推广费用
  • 猪八戒网做网站被骗百度小说排行榜前十名
  • 数学教学网站开发seo系统是什么
  • 买域名自己做网站兰州seo关键词优化
  • 有专做代金券的网站吗天津seo排名公司
  • 微商城电商系统开发商上海百度seo网站优化
  • 设计宝藏资源站今日重要新闻
  • 丹徒网站建设服务seo 深圳
  • mac上如何使用wordpress海口seo网络公司
  • 成都网站建设前50强简述网站推广的方法
  • 别人给公司做的网站字体侵权吗百度信息流推广是什么意思
  • 做网站怎么防止被黑线上推广方案模板
  • 装修设计图网站排名网上引流推广怎么做
  • 做淘宝还有必要做网站吗长春网站公司哪家好
  • 胶州专业网站建设公司无锡网站建设seo
  • 开发动态网站价格优化疫情二十条措施
  • 网站速度慢wordpress赣州是哪个省
  • 网站开发国内现状查询关键词排名软件
  • 国内免费saas crm正在关键词优化按天计费
  • 做交友网站多少钱怎样免费给自己的公司做网站
  • dreamweaver如何设计网站末班推广平台排名
  • 网站制作软件百度快照推广一年要多少钱
  • 做网站材料百度移动端排名
  • 技术支持 上海做网站米拓建站
  • 镜像别人网站做排名的好处软文发稿平台有哪些