mirror of
https://github.com/pyannote/pyannote-audio.git
synced 2026-11-30 09:13:56 +09:00
178 lines
4.2 KiB
Plaintext
178 lines
4.2 KiB
Plaintext
{
|
||
"cells": [
|
||
{
|
||
"cell_type": "code",
|
||
"execution_count": null,
|
||
"metadata": {},
|
||
"outputs": [],
|
||
"source": [
|
||
"from pyannote.database import get_protocol, FileFinder\n",
|
||
"protocol = get_protocol('Debug.SpeakerDiarization.Debug', \n",
|
||
" preprocessors={\"audio\": FileFinder()})"
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "code",
|
||
"execution_count": null,
|
||
"metadata": {},
|
||
"outputs": [],
|
||
"source": [
|
||
"from pyannote.audio.models.segmentation.debug import SimpleSegmentationModel\n",
|
||
"from pyannote.audio.models.embedding.debug import SimpleEmbeddingModel\n",
|
||
"import pytorch_lightning as pl"
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "code",
|
||
"execution_count": null,
|
||
"metadata": {},
|
||
"outputs": [],
|
||
"source": [
|
||
"from pyannote.audio.utils.preview import listen\n",
|
||
"listen(next(protocol.train()))"
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "markdown",
|
||
"metadata": {},
|
||
"source": [
|
||
"## Voice activity detection"
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "code",
|
||
"execution_count": null,
|
||
"metadata": {},
|
||
"outputs": [],
|
||
"source": [
|
||
"from pyannote.audio.tasks import VoiceActivityDetection\n",
|
||
"vad = VoiceActivityDetection(protocol, duration=2., batch_size=32, num_workers=4)\n",
|
||
"model = SimpleSegmentationModel(task=vad)\n",
|
||
"trainer = pl.Trainer(max_epochs=1)\n",
|
||
"_ = trainer.fit(model)"
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "markdown",
|
||
"metadata": {},
|
||
"source": [
|
||
"## Speaker change detection"
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "code",
|
||
"execution_count": null,
|
||
"metadata": {},
|
||
"outputs": [],
|
||
"source": [
|
||
"from pyannote.audio.tasks import SpeakerChangeDetection\n",
|
||
"scd = SpeakerChangeDetection(protocol, duration=2., batch_size=32, num_workers=4)\n",
|
||
"model = SimpleSegmentationModel(task=scd)\n",
|
||
"trainer = pl.Trainer(max_epochs=1)\n",
|
||
"_ = trainer.fit(model)"
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "markdown",
|
||
"metadata": {},
|
||
"source": [
|
||
"## Overlapped speech detection"
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "code",
|
||
"execution_count": null,
|
||
"metadata": {},
|
||
"outputs": [],
|
||
"source": [
|
||
"from pyannote.audio.tasks import OverlappedSpeechDetection\n",
|
||
"ovl = OverlappedSpeechDetection(protocol, duration=2., batch_size=32, num_workers=4)\n",
|
||
"model = SimpleSegmentationModel(task=ovl)\n",
|
||
"trainer = pl.Trainer(max_epochs=1)\n",
|
||
"_ = trainer.fit(model)"
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "markdown",
|
||
"metadata": {},
|
||
"source": [
|
||
"## Segmentation"
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "code",
|
||
"execution_count": null,
|
||
"metadata": {},
|
||
"outputs": [],
|
||
"source": [
|
||
"from pyannote.audio.tasks import Segmentation\n",
|
||
"seg = Segmentation(protocol, duration=2., batch_size=32, num_workers=4)\n",
|
||
"model = SimpleSegmentationModel(task=seg)\n",
|
||
"trainer = pl.Trainer(max_epochs=1)\n",
|
||
"_ = trainer.fit(model)"
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "markdown",
|
||
"metadata": {},
|
||
"source": [
|
||
"## Speaker tracking"
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "code",
|
||
"execution_count": null,
|
||
"metadata": {},
|
||
"outputs": [],
|
||
"source": [
|
||
"from pyannote.audio.tasks import SpeakerTracking\n",
|
||
"spk = SpeakerTracking(protocol, duration=2., batch_size=32, num_workers=4)\n",
|
||
"model = SimpleSegmentationModel(task=spk)\n",
|
||
"trainer = pl.Trainer(max_epochs=1)\n",
|
||
"_ = trainer.fit(model)"
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "markdown",
|
||
"metadata": {},
|
||
"source": [
|
||
"## Speaker embedding"
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "code",
|
||
"execution_count": null,
|
||
"metadata": {},
|
||
"outputs": [],
|
||
"source": [
|
||
"from pyannote.audio.tasks import SpeakerEmbedding\n",
|
||
"emb = SpeakerEmbedding(protocol, duration=2., num_workers=4)\n",
|
||
"model = SimpleEmbeddingModel(task=emb)\n",
|
||
"trainer = pl.Trainer(max_epochs=1)\n",
|
||
"_ = trainer.fit(model)"
|
||
]
|
||
}
|
||
],
|
||
"metadata": {
|
||
"kernelspec": {
|
||
"display_name": "Python 3",
|
||
"language": "python",
|
||
"name": "python3"
|
||
},
|
||
"language_info": {
|
||
"codemirror_mode": {
|
||
"name": "ipython",
|
||
"version": 3
|
||
},
|
||
"file_extension": ".py",
|
||
"mimetype": "text/x-python",
|
||
"name": "python",
|
||
"nbconvert_exporter": "python",
|
||
"pygments_lexer": "ipython3",
|
||
"version": "3.8.5"
|
||
}
|
||
},
|
||
"nbformat": 4,
|
||
"nbformat_minor": 4
|
||
}
|