二聚工具箱包装器

pydiarization的Python项目详细描述


pydialization

pydialization是IBDiarization工具包的包装器。

要求

您的路径中必须包含以下二进制文件:

  • ffmpeg
  • compute mfcc featscopy feats to htkfrom kaldi
  • diarizeme来自ibdialization工具包。

安装

Pydiation可以通过conda安装

conda install -c wdroz pydiarization

或pip

pip install pydiarization

用法

在使用pywrapper之前,必须创建一个包含ibdialization工具包结果的文件夹。

mkdir result.dir

测试安装

若要检查所有二进制文件是否正常工作并被pydialization识别,可以键入:python3 -m pydiarization.test_diarization_wrapper

从代码

将单个视频转换为字符串(.rttm内容)的示例

frompydiarization.diarization_wrapperimportvideo_to_rttm_stringrttm_content=video_to_rttm_string('MY_VIDEO_OR_URL.avi')

下面是所有高级api的列表:

defvideo_to_rttm_string(video_path):""" High-level function that return the rttm as string from a video    Arguments:    video_path -- where the video is    Return: the rttm content as string    """defwav_to_rttm_string(wav_path):""" High-level function that return the rttm as string from a wav    Arguments:    wav_path -- where the wav is    Return: the rttm content as string    """defrttm_to_string(rttm_path):""" transform rttm file to string    Arguments:    rttm_path -- where is the rttm file    Return: rttm content as string    """defrttm_from_video(video_path,rttm_path):""" create a .rttm file from a video    Arguments:    video_path -- path to the video    rttm_path -- path where the .rrtm file will be saved    """defrttm_from_wav(wav_path,rttm_path):""" create a .rttm file from a wav    Arguments:    wav_path -- path to the wav file    rttm_path -- path where the .rrtm file will be saved    """

来自cli

用法如下:

$ python3 -m pydiarization.run --help
usage: run.py [-h] [--video VIDEO] [--wav WAV] [--output OUTPUT]

Diarization Toolkit Wrapper CLI

optional arguments:
  -h, --help       show this help message and exit
  --video VIDEO    take a video file or URL as input
  --wav WAV        take a wav file as input
  --output OUTPUT  specify to write as .rttm file

一些示例

请求从URL获取.rttm内容: python3 -m pydiarization.run --video http://data.cstr.inf.ed.ac.uk/summa/data/test.mp4

SPEAKER tmp86hrhwsd 1 0.01 292.17 <NA> <NA> tmp86hrhwsd_spkr_9 <NA>
SPEAKER tmp86hrhwsd 1 292.18 2.98 <NA> <NA> tmp86hrhwsd_spkr_2 <NA>

请求改为写入.rttm文件: python3 -m pydiarization.run --video http://data.cstr.inf.ed.ac.uk/summa/data/test.mp4 --output toto.rttm

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
计算Java和C之间字符串差异的显示宽度#   java在不关闭连接的情况下通过ADB多次访问应用程序数据库?   java使用testNG使测试并行运行   使用正则表达式模式替换文本块(在java中)   为Shopify应用程序生成访问令牌时发生java错误   找不到请求操作的java编解码器:[varchar<>com.thelastpickle.tlpstress.PartitionKey]   java用不同的字符替换字符串中的所有字符   java返回结果集会减慢程序的运行速度   java JPA,打开JPA OneToMany FailedObject   java如何在ArrayList中访问对象集并获取方法?   java Struts2增加上一个集合的<s:set/>值   在引用Java中的函数后使用外部函数   java如何配置两个hazelcast缓存(即IMap),一个用于分布式缓存,另一个用于单实例缓存   调试查找在java应用程序中执行的方法