Skip to main content

Diarization toolkit wrapper

Project description

pydiarization

pydiarization is a wrapper around the IBDiarization toolkit.

Requirements

You must have the follow binaries in your path:

  • ffmpeg
  • compute-mfcc-feats and copy-feats-to-htk from Kaldi
  • diarizeme from the IBDiarization toolkit.

Installation

pydiarization can be installed by either conda

conda install -c wdroz pydiarization

or pip

pip install pydiarization

Usage

Before using the pywrapper, you have to create a folder that will contains the results of the IBDiarization toolkit.

mkdir result.dir

Test the installation

To check if all binaries works and are recognized by pydiarization, you can run the tests by typing: python3 -m pydiarization.test_diarization_wrapper

from code

Example that convert a single video to a string (.rttm content)

from pydiarization.diarization_wrapper import video_to_rttm_string

rttm_content = video_to_rttm_string('MY_VIDEO_OR_URL.avi')

Here the list of all the high-levels API:

def video_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
    """
def wav_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
    """
def rttm_to_string(rttm_path):
    """ transform rttm file to string
    Arguments:
    rttm_path -- where is the rttm file

    Return: rttm content as string
    """
def rttm_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
    """
def rttm_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
    """

from CLI

The usage is the follow:

$ 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

some examples

Ask to get the .rttm content from a url: python3 -m pydiarization.run --video http://data.cstr.inf.ed.ac.uk/summa/data/test.mp4

SPEAKER tmp86hrhwsd 1 0.01 292.17   tmp86hrhwsd_spkr_9 
SPEAKER tmp86hrhwsd 1 292.18 2.98   tmp86hrhwsd_spkr_2 

Ask to write to .rttm file instead: python3 -m pydiarization.run --video http://data.cstr.inf.ed.ac.uk/summa/data/test.mp4 --output toto.rttm

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pydiarization-0.4.tar.gz (6.0 kB view details)

Uploaded Source

Built Distribution

pydiarization-0.4-py3-none-any.whl (7.6 kB view details)

Uploaded Python 3

File details

Details for the file pydiarization-0.4.tar.gz.

File metadata

  • Download URL: pydiarization-0.4.tar.gz
  • Upload date:
  • Size: 6.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.19.1 setuptools/40.4.3 requests-toolbelt/0.8.0 tqdm/4.26.0 CPython/3.7.0

File hashes

Hashes for pydiarization-0.4.tar.gz
Algorithm Hash digest
SHA256 5da92b29c72e1cc4f5c35fb56199c33986059d33f8fd2cf6adaad3482584f2c1
MD5 dfbfd54afa813ac2b91ddf8fbe90d556
BLAKE2b-256 5a9f16265eaa84229b015905a6be36d8734a37653160db48fa09ea41fb2abc03

See more details on using hashes here.

File details

Details for the file pydiarization-0.4-py3-none-any.whl.

File metadata

  • Download URL: pydiarization-0.4-py3-none-any.whl
  • Upload date:
  • Size: 7.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.19.1 setuptools/40.4.3 requests-toolbelt/0.8.0 tqdm/4.26.0 CPython/3.7.0

File hashes

Hashes for pydiarization-0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 27310c6026fcab3c966e259d262d75ad8cd0e2fb4a1fdafe458acfb5538c38f7
MD5 ee4fdbfafa302a351b82862a2dc02751
BLAKE2b-256 fbc5518261e06e0231afbc0a5767bd046bf624c0c0a7d9bdb56bf35040683158

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page