PyDiar
This repo contains simple to use, pretrained/training-less models for speaker diarization.
Supported Models
-
Binary Key Speaker Modeling
Based on pyBK by Jose Patino which implements the diarization system from "The EURECOM submission to the first DIHARD Challenge" by Patino, Jose and Delgado, Héctor and Evans, Nicholas
If you have any other models you would like to see added, please open an issue.
Usage
This library seeks to provide a very basic interface. To use the Binary Key model on a file, do something like this:
import numpy as np
from pydiar.models import BinaryKeyDiarizationModel, Segment
from pydiar.util.misc import optimize_segments
from pydub import AudioSegment
INPUT_FILE = "test.wav"
sample_rate = 32000
audio = AudioSegment.from_wav("test.wav")
audio = audio.set_frame_rate(sample_rate)
audio = audio.set_channels(1)
diarization_model = BinaryKeyDiarizationModel()
segments = diarization_model.diarize(
sample_rate, np.array(audio.get_array_of_samples())
)
optimized_segments = optimize_segments(segments)
Now optimized_segments contains a list of segments with their start, length and speaker id
Example
A simple script which reads an audio file, diarizes it and transcribes it into the WebVTT format can be found in examples/generate_webvtt.py.
To use it, download a vosk model from https://alphacephei.com/vosk/models and then run the script using
poetry install
poetry run python -m examples.generate_webvtt -i PATH/TO/INPUT.wav -m PATH/TO/VOSK_MODEL
Metadata
Release files for pydiar 0.0.7
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| PyDiar-0.0.7.tar.gz | 28.1 kB | Without provenance | Details for PyDiar-0.0.7.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| PyDiar-0.0.7-py3-none-any.whl | Python 3 | none | any | Details for PyDiar-0.0.7-py3-none-any.whl |
Total release size: 57.1 kB
Release files / PyDiar-0.0.7.tar.gz
| Download URL | PyDiar-0.0.7.tar.gz |
|---|---|
| Size | 28.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
6f5ed827b655a774e7b67648f565d663523b710c4a51b5df69ce0dadadcc6ef2
|
|
BLAKE2b-256 checksum How to use checksums |
1696e82f6c7d79f7d1b272d28b209bedd9b659f726c95ee51b573640ddf5a146
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.1.10 CPython/3.9.6 Darwin/21.3.0
|
Release files / PyDiar-0.0.7-py3-none-any.whl
| Download URL | PyDiar-0.0.7-py3-none-any.whl |
|---|---|
| Size | 29.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e592afd4f8c753b6763f8049030838c72b337f44282549846a126dadee951d82
|
|
BLAKE2b-256 checksum How to use checksums |
1ff6f7f38c693e6ed735aed2f194e0642c100b3ad63f7448ee31ff5dc68bd6ac
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.1.10 CPython/3.9.6 Darwin/21.3.0
|
Security for pydiar 0.0.7
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.