Last active
January 26, 2017 19:41
-
-
Save hbredin/ba87e6b04846f7428356df6d4d612316 to your computer and use it in GitHub Desktop.
On the evaluation of speaker turn segmentation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"cells": [ | |
{ | |
"cell_type": "code", | |
"execution_count": 1, | |
"metadata": { | |
"collapsed": false | |
}, | |
"outputs": [ | |
{ | |
"name": "stdout", | |
"output_type": "stream", | |
"text": [ | |
"Populating the interactive namespace from numpy and matplotlib\n" | |
] | |
} | |
], | |
"source": [ | |
"%pylab inline\n", | |
"from pyannote.core import Segment, Timeline, Annotation, SlidingWindow, notebook\n", | |
"from pyannote.metrics.segmentation import SegmentationPurity, SegmentationCoverage\n", | |
"from pyannote.metrics.segmentation import SegmentationPrecision, SegmentationRecall" | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
"# On the evaluation of speaker turn segmentation" | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
"Let's consider a 15 seconds audio recording whose \"speaker\" reference is depicted below (three speakers, denoted 1 to 3):" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 2, | |
"metadata": { | |
"collapsed": false | |
}, | |
"outputs": [ | |
{ | |
"data": { | |
"image/png": "iVBORw0KGgoAAAANSUhEUgAABHEAAACsCAYAAAD8BzCjAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAADJBJREFUeJzt3XGMpOVdB/DvrxymBaqohy0eF69pKkqIhWZtzpI02laL\npTlI/EdTSY39x0RbME1Mq4nIPwZjY22i0TRYwUgwBiglNMoRJDYmpWXvhAMOsbVqufPq0RAsZ6Ol\n5ecfM21PKLndu9l975n9fJLJzjv7zuY7m2dn3v3O8z5T3R0AAAAATm8vmzoAAAAAACemxAEAAAAY\ngBIHAAAAYABKHAAAAIABKHEAAAAABqDEA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OnEeBldV\nv5TknUneNS8G4WS9NrM3MB6eH6dfkGR/Vb160lSDW0uJ82CS11XVa6rquzJbiO+ujY3FMquqymyd\nice7+w+mzsP4uvuD3X1Bd+/K7Dnq77rbu9yctO7+UpInq+rC+U1vTXJwwkiM7YtJdlfVWfPXwLfG\nQtkszl1J3j2//u4kn5gwC4OrqsszOz19T3d/deo8jK27H+nuH+juXfPj9ENJ3jA/zuIknbDEmS9s\n9WtJ7snsgOOvu/uxjQ7GUrssydWZzZZ4aH55x9ShAF7gvUluqaoDSS5J8rsT52FQ8xldtyXZn+SR\nzI6/PjppKIZUVbcm+XSSC6vqUFW9J8kNSX66qj6X2ayvG6bMyDheYjz9UZJXJrl3foz+p5OGZCgv\nMaZYsDJDDgAAAOD0Z2FjAAAAgAEocQAAAAAGoMQBAAAAGIASBwAAAGAAShwAAACAAWybOgAAwIlU\n1fcnuW+++eok30jy1Hz7q939pkmCAQBsIh8xDgAMpap+J8mx7v7Q1FkAADaT06kAgKFV1bH515+s\nqr+vqk9U1Req6oaqeldVfbaqHqmq1873O6+qbq+qB+eXy6Z9BAAAa6PEAQCWyeuT/EqSH01ydZIf\n7u43JrkxyXvn+3wkyYe7+8eT/Nz8ewAApz1r4gAAy+TB7j6SJFX1L0n2zm9/JMlPza+/LclFVfXN\n+3x3VZ3T3cc2NSkAwDopcQCAZfK/x11//rjt5/Pt456XJdnd3f+zmcEAAE6V06kAgK1mb759alWq\n6pIJswAArJkSBwDYat6XZKWqDlTVwczW0AEAOO35iHEAAACAAZiJAwAAADAAJQ4AAADAAJQ4AAAA\nAANQ4gAAAAAMQIkDAAAAMAAlDgAAAMAAlDgAAAAAA1DiAAAAAAzg/wD7XYXWnq3bQAAAAABJRU5E\nrkJggg==\n", | |
"text/plain": [ | |
"<pyannote.core.annotation.Annotation at 0x112c459e8>" | |
] | |
}, | |
"execution_count": 2, | |
"metadata": {}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"reference = Annotation()\n", | |
"reference[Segment( 0.0, 4.0)] = 1\n", | |
"reference[Segment( 4.2, 6.0)] = 1\n", | |
"reference[Segment( 9.0, 10.0)] = 2\n", | |
"reference[Segment(11.0, 14.0)] = 1\n", | |
"reference[Segment(12.0, 15.0)] = 3\n", | |
"reference" | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
"A segmentation algorithms processes the whole audio recording (even non-speech region) and outputs the following hypothesis segmentation:" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 3, | |
"metadata": { | |
"collapsed": false | |
}, | |
"outputs": [ | |
{ | |
"data": { | |
"image/png": "iVBORw0KGgoAAAANSUhEUgAABHEAAABnCAYAAACHKN7UAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAACPtJREFUeJzt3WuoZXUZBvDnzSnK7D5W5khHoptEN6awhLQrVpJBX4qK\nor4E3QmiC0SfQigyoSjESiExQo0iqBSL+tLFGSstze6XUUsjulh09e3D3tGkDbPPaZ1Z/vf5/eBw\n9tpnneGZzctZ6zx7rf+p7g4AAAAAd253mTsAAAAAAIenxAEAAAAYgBIHAAAAYABKHAAAAIABKHEA\nAAAABqDEAQAAABiAEgcAAABgAEocAAAAgAEocQAAAAAGsGszO+/evbs3Nja2KQoAAADAzrN///7f\ndPexh9tvUyXOxsZG9u3bt/VUAAAAAPyXqvr5Kvu5nQoAAABgAEocAAAAgAEocQAAAAAGoMQBAAAA\nGIASBwAAAGAAShwAAACAAShxAAAAAAagxAEAAAAYgBIHAAAAYABKHAAAAIABKHEAAAAABqDEAQAA\nABiAEgcAAABgAEocAAAAgAEocQAAAAAGoMQBAAAAGIASBwAAAGAAShwAAACAAShxAAAAAAagxAEA\nAAAYgBIHAAAAYABKHAAAAIABKHEAAAAABrCpEufGG2/crhzsUKeddtrcEVgj5ml1XisAdhLHPaZm\npphLdffqO1f1ZvaHw6mqmCmmYp5W57UCYCdx3GNqZoqpVdX+7t57uP3cTgUAAAAwg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ugkL0/yiO5+cpLz\nkrx+uc85Sc7u7icledHyawAAd3rWxAEA1smV3X1TklTVj5Nctnz+miRPXz5+VpKTqurf33Pvqjqm\nu289okkBADZJiQMArJO/HvT4toO2b8t/znvukuTk7v7LkQwGAPD/cjsVALDTXJb/3FqVqnr8jFkA\nAFamxAEAdpo3JNlbVVdX1bVZrKEDAHCn50+MAwAAAAzAlTgAAAAAA1DiAAAAAAxAiQMAAAAwACUO\nAAAAwACUOAAAAAADUOIAAAAADECJAwAAADAAJQ4AAADAAP4FVjj2uqp+IG0AAAAASUVORK5CYII=\n", | |
"text/plain": [ | |
"<Timeline(uri=None, segments=[<Segment(0, 2)>, <Segment(2, 4)>, <Segment(4, 5)>, <Segment(5, 11)>, <Segment(11, 13)>, <Segment(13, 15)>])>" | |
] | |
}, | |
"execution_count": 3, | |
"metadata": {}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"hypothesis = Timeline()\n", | |
"hypothesis.add(Segment( 0.0, 2.0))\n", | |
"hypothesis.add(Segment( 2.0, 4.0))\n", | |
"hypothesis.add(Segment( 4.0, 5.0))\n", | |
"hypothesis.add(Segment( 5.0, 11.0))\n", | |
"hypothesis.add(Segment(11.0, 13.0))\n", | |
"hypothesis.add(Segment(13.0, 15.0))\n", | |
"hypothesis" | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
"Two evaluation metrics can be computed that evaluate the purity and coverage of hypothesized segments." | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 4, | |
"metadata": { | |
"collapsed": false | |
}, | |
"outputs": [], | |
"source": [ | |
"purity = SegmentationPurity(tolerance=0.5)\n", | |
"coverage = SegmentationCoverage(tolerance=0.5)" | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
"Purity measures how pure (in terms of reference speaker) each hypothesized segment is." | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 5, | |
"metadata": { | |
"collapsed": false | |
}, | |
"outputs": [ | |
{ | |
"data": { | |
"text/plain": [ | |
"0.8181818181818182" | |
] | |
}, | |
"execution_count": 5, | |
"metadata": {}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"purity(reference, hypothesis)" | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
"Perfect purity (1) can be achieved easily by oversegmenting." | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 6, | |
"metadata": { | |
"collapsed": false | |
}, | |
"outputs": [ | |
{ | |
"data": { | |
"image/png": "iVBORw0KGgoAAAANSUhEUgAABHEAAABnCAYAAACHKN7UAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAClFJREFUeJzt3W+sZHdZB/DvQ1ejBRV0C9Ru4xICaEPkT66k0sSugqYq\noSa+0SDBaNKYKKAhIaCJvX1jmkhEEo1mU7UkNhhTMBAStU0l+MY/vVulhdYKosK2iy0xKpUoYh9f\nzDSsLc2dO3funPub+XySzZ2ZPc+e7579zb2z3zvn3OruAAAAAHC8PWPqAAAAAADsT4kDAAAAMAAl\nDgAAAMAAlDgAAAAAA1DiAAAAAAxAiQMAAAAwACUOAAAAwACUOAAAAAADUOIAAAAADODEQTY+efJk\nnz59+oiiAAAAAGyfc+fOfb67L9tvuwOVOKdPn87e3t7yqQAAAAD4f6rqnxfZzulUAAAAAANQ4gAA\nAAAMQIkDAAAAMAAlDgAAAMAAlDgAAAAAA1DiAAAAAAxAiQMAAAAwACUOAAAAwACUOAAAAAADUOIA\nAAAADECJAwAAADAAJQ4AAADAAJQ4AAAAAANQ4gAAAAAM4EAlzsMPP7z0js6cObPWObObPTtV3t3d\n3a2aneJYTZV322anWFOO0+K26Vht23HaptnR8po93vs0e/xnR8tr9njvcxtnF1XdvfjGVX2Q7Z80\nm2Vml50zu9mzo+U1e7z3aXY9s6PlNbue2dHymj3e+zS7ntnR8ppdz+xoec0e731u6ey57t7Zbzun\nU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4yf+g1Se6fMBJj+0ySq6vq0vnXwNfEhbJZnQ8ledP8\n9puSfHDCLAyuqq7L7PT013f3F6fOw9i6+77ufm53n56/Tj+f5JXz11ksad8SZ35hq59L8qeZveD4\nw+7+xFEHY6Ndk+SNmb1b4m/nv35o6lAAT/LmJLdV1b1JXp7kVybOw6Dm7+i6Pck9Se7L7PXX2UlD\nMaSqel+Sv0jykqo6X1U/neTmJN9fVZ/M7F1fN0+ZkXE8zXr6jSTfkOTO+Wv03540JEN5mjXFipV3\nyAEAAAAcfy5sDAAAADAAJQ4AAADAAJQ4AAAAAANQ4gAAAAAMQIkDAAAAMIATUwcAANhPVX1Lkrvm\nd5+f5H+TPDq//8XufvUkwQAA1siPGAcAhlJVu0ke6+53TZ0FAGCdnE4FAAytqh6bfzxTVR+tqg9W\n1aer6uaqekNV/XVV3VdVL5xvd1lVvb+q7p7/umbavwEAwGKUOADAJnlZkp9J8h1J3pjkxd39qiS3\nJHnzfJv3JHl3d39Xkh+d/x4AwLHnmjgAwCa5u7svJElV/UOSO+aP35fke+e3X5vkqqp6YuYbq+pZ\n3f3YWpMCAByQEgcA2CT/fdHtxy+6/3i+8rrnGUmu7u7/WmcwAIDDcjoVALBt7shXTq1KVb18wiwA\nAAtT4gAA2+YtSXaq6t6quj+za+gAABx7fsQ4AAAAwAC8EwcAAABgAEocAAAAgAEocQAAAAAGoMQB\nAAAAGIASBwAAAGAAShwAAACAAShxAAAAAAagxAEAAAAYwP8B6X2GE2Ah9O0AAAAASUVORK5CYII=\n", | |
"text/plain": [ | |
"<Timeline(uri=None, segments=[<Segment(0, 0.2)>, <Segment(0.2, 0.4)>, <Segment(0.4, 0.6)>, <Segment(0.6, 0.8)>, <Segment(0.8, 1)>, <Segment(1, 1.2)>, <Segment(1.2, 1.4)>, <Segment(1.4, 1.6)>, <Segment(1.6, 1.8)>, <Segment(1.8, 2)>, <Segment(2, 2.2)>, <Segment(2.2, 2.4)>, <Segment(2.4, 2.6)>, <Segment(2.6, 2.8)>, <Segment(2.8, 3)>, <Segment(3, 3.2)>, <Segment(3.2, 3.4)>, <Segment(3.4, 3.6)>, <Segment(3.6, 3.8)>, <Segment(3.8, 4)>, <Segment(4, 4.2)>, <Segment(4.2, 4.4)>, <Segment(4.4, 4.6)>, <Segment(4.6, 4.8)>, <Segment(4.8, 5)>, <Segment(5, 5.2)>, <Segment(5.2, 5.4)>, <Segment(5.4, 5.6)>, <Segment(5.6, 5.8)>, <Segment(5.8, 6)>, <Segment(6, 6.2)>, <Segment(6.2, 6.4)>, <Segment(6.4, 6.6)>, <Segment(6.6, 6.8)>, <Segment(6.8, 7)>, <Segment(7, 7.2)>, <Segment(7.2, 7.4)>, <Segment(7.4, 7.6)>, <Segment(7.6, 7.8)>, <Segment(7.8, 8)>, <Segment(8, 8.2)>, <Segment(8.2, 8.4)>, <Segment(8.4, 8.6)>, <Segment(8.6, 8.8)>, <Segment(8.8, 9)>, <Segment(9, 9.2)>, <Segment(9.2, 9.4)>, <Segment(9.4, 9.6)>, <Segment(9.6, 9.8)>, <Segment(9.8, 10)>, <Segment(10, 10.2)>, <Segment(10.2, 10.4)>, <Segment(10.4, 10.6)>, <Segment(10.6, 10.8)>, <Segment(10.8, 11)>, <Segment(11, 11.2)>, <Segment(11.2, 11.4)>, <Segment(11.4, 11.6)>, <Segment(11.6, 11.8)>, <Segment(11.8, 12)>, <Segment(12, 12.2)>, <Segment(12.2, 12.4)>, <Segment(12.4, 12.6)>, <Segment(12.6, 12.8)>, <Segment(12.8, 13)>, <Segment(13, 13.2)>, <Segment(13.2, 13.4)>, <Segment(13.4, 13.6)>, <Segment(13.6, 13.8)>, <Segment(13.8, 14)>, <Segment(14, 14.2)>, <Segment(14.2, 14.4)>, <Segment(14.4, 14.6)>, <Segment(14.6, 14.8)>, <Segment(14.8, 15)>])>" | |
] | |
}, | |
"execution_count": 6, | |
"metadata": {}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"oversegmentation = Timeline(SlidingWindow(start=0., end=15, duration=0.2, step=0.2))\n", | |
"oversegmentation" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 7, | |
"metadata": { | |
"collapsed": false | |
}, | |
"outputs": [ | |
{ | |
"data": { | |
"text/plain": [ | |
"1.0" | |
] | |
}, | |
"execution_count": 7, | |
"metadata": {}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"purity(reference, oversegmentation)" | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
"Coverage is the dual metric where the role of reference and hypothesis are interchanged." | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 8, | |
"metadata": { | |
"collapsed": false | |
}, | |
"outputs": [ | |
{ | |
"data": { | |
"text/plain": [ | |
"0.5454545454545454" | |
] | |
}, | |
"execution_count": 8, | |
"metadata": {}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"coverage(reference, hypothesis)" | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
"Similarly, perfect coverage (1) can be achieved by undersegmenting:" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 9, | |
"metadata": { | |
"collapsed": false | |
}, | |
"outputs": [ | |
{ | |
"data": { | |
"image/png": "iVBORw0KGgoAAAANSUhEUgAABHEAAABnCAYAAACHKN7UAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAACJ9JREFUeJzt3WuoZXUZBvDn1SlK7T5WM450JMoSqRQTS4guFnahCfpS\nVBj1JeiOEF0g+hRCUQlFEVYGiRFqFEE1YlFfungpL2mm2W2cMY3oYlFWvn3YW5y0cc457nPW/Pf8\nfnDYa+2zzvAMvJy9zrPX+u/q7gAAAABwcDts6gAAAAAAHJgSBwAAAGAAShwAAACAAShxAAAAAAag\nxAEAAAAYgBIHAAAAYABKHAAAAIABKHEAAAAABqDEAQAAABjAlrUcvHXr1l5ZWdmgKAAAAACHniuv\nvPIP3X30gY5bU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ayn5liwcoVcgAAAAAHPwsbAwAAAAxAiQMAAAAwACUOAAAAwACUOAAA\nAAADUOIAAAAADGDL1AEAAA6kqh6X5LL57hOT/CfJHfP9v3f3cycJBgCwiXzEOAAwlKr6UJI7u/uj\nU2cBANhMbqcCAIZWVXfOH59fVd+rqq9V1S1VdU5Vva6qflxV11bVk+fHHV1VF1fV5fOv06f9HwAA\nrI4SBwBYJs9M8pYkT0/yhiRP7e5Tk5yX5O3zY85N8vHufnaSV8+/BwBw0LMmDgCwTC7v7r1JUlW/\nTLJr/vy1SV4w3z4jyQlVdc/PPLKqjuruOzc1KQDAGilxAIBl8s99tu/eZ//u3Hvec1iS07r7H5sZ\nDADgwXI7FQBwqNmVe2+tSlU9a8IsAACrpsQBAA4170hySlVdU1XXZ7aGDgDAQc9HjAMAAAAMwJU4\nAAAAAANQ4gAAAAAMQIkDAAAAMAAlDgAAAMAAlDgAAAAAA1DiAAAAAAxAiQMAAAAwACUOAAAAwAD+\nC+P9vkUECKzyAAAAAElFTkSuQmCC\n", | |
"text/plain": [ | |
"<Timeline(uri=None, segments=[<Segment(0, 15)>])>" | |
] | |
}, | |
"execution_count": 9, | |
"metadata": {}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"undersegmentation = Timeline([Segment(0, 15)])\n", | |
"undersegmentation" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 10, | |
"metadata": { | |
"collapsed": false | |
}, | |
"outputs": [ | |
{ | |
"data": { | |
"text/plain": [ | |
"1.0" | |
] | |
}, | |
"execution_count": 10, | |
"metadata": {}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"coverage(reference, undersegmentation)" | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
"Let's discuss the implementation details of these two metrics." | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
"First, reference is preprocessed to remove short gap between speech from the same speaker.\n", | |
"The maximum duration of gaps is the parameter `tolerance` passed to `SegmentationPurity` and `SegmentationCoverage`.\n", | |
"The defaults value is 0.5 (i.e. 500ms)." | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 11, | |
"metadata": { | |
"collapsed": true | |
}, | |
"outputs": [], | |
"source": [ | |
"preprocessed_reference, preprocessed_hypothesis = coverage._preprocess(reference, hypothesis)" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 12, | |
"metadata": { | |
"collapsed": false | |
}, | |
"outputs": [ | |
{ | |
"data": { | |
"image/png": "iVBORw0KGgoAAAANSUhEUgAABHEAAACsCAYAAAD8BzCjAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAADVBJREFUeJzt3X+snXV9B/D3R8qiyDa3wdS1zWqMY2vIANOZTpLFqZto\nSWuyf8aEuMw/WOIPXFwMbsmEfxaWmanJzIZhCgkEY0SFaBwQR+Y/orQI5ddQxpy0w1VDnDIzEfns\nj3MMHch6W57bp9/T1ys5uc9z7nNv38/tN/ec+z7f53uquwMAAADAse05cwcAAAAA4NCUOAAAAAAD\nUOIAAAAADECJAwAAADAAJQ4AAADAAJQ4AAAAAANQ4gAAAAAMQIkDAAAAMAAlDgAAAMAAlDgAAAAA\nAxiuxKmqc6rq/qp6oKounjvPVKrqI1V1oKrunjvLlKpqc1XdUlX3VtU9VXXR3JmmUFXPraovV9Wd\ny/O6dO5MU6qqE6rqK1X1mbmzAAAAsDBUiVNVJyT5UJLXJ9ma5Lyq2jpvqslcmeScuUOsg8eTvKu7\ntybZnuStK/J/9oMkr+7uM5KcmeScqto+c6YpXZTkvrlDAAAA8KShSpwkr0jyQHc/2N2PJflYkl0z\nZ5pEd38hySNz55hadz/c3bcvt7+XRTGwcd5Uz14vPLrcPXF56xkjTaaqNiXZkeSKubMAAADwpNFK\nnI1JHjpof19WoBA4XlTVliRnJfnSvEmmsbzk6I4kB5Lc3N0rcV5JPpDk3UmemDsIAAAAT9rwbL54\n/8bNk8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+fp+5K8fPk8iyN0yBJnubDV25LcmMUTjo939z3rHYyVdnaSC7KYLXHH8vaGuUMBPMXbk1xT\nVXuTnJnkL2fOw6CWM7o+keT2JHdl8fzrw7OGYkhVdW2SLyY5rar2VdVbklyW5Heq6mtZzPq6bM6M\njOMZxtPfJvnpJDcvn6P//awhGcozjCkmVmbIAQAAABz7LGwMAAAAMAAlDgAAAMAAlDgAAAAAA1Di\nAAAAAAxAiQMAAAAwgA1zBwAAOJSq+oUkn1/uvijJj5J8a7n//e5+5SzBAACOIm8xDgAMpaouSfJo\nd79v7iwAAEeTy6kAgKFV1aPLj6+qqn+uquur6sGquqyq3lRVX66qu6rqpcvjTq2q66rqtuXt7HnP\nAABgbZQ4AMAqOSPJHyf5tSQXJPmV7n5FkiuSvH15zAeTvL+7fyPJ7y0/BwBwzLMmDgCwSm7r7oeT\npKr+NclNy/vvSvLby+3XJtlaVT/+mp+pqpO7+9GjmhQA4DApcQCAVfKDg7afOGj/iTz5vOc5SbZ3\n9/8czWAAAM+Wy6kAgOPNTXny0qpU1ZkzZgEAWDMlDgBwvHlHkm1Vtbeq7s1iDR0AgGOetxgHAAAA\nGICZOAAAAAADUOIAAAAADECJAwAAADAAJQ4AAADAAJQ4AAAAAANQ4gAAAAAMQIkDAAAAMAAlDgAA\nAMAA/hfBo6MiebyYpgAAAABJRU5ErkJggg==\n", | |
"text/plain": [ | |
"<pyannote.core.annotation.Annotation at 0x112d015c0>" | |
] | |
}, | |
"execution_count": 12, | |
"metadata": {}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"notebook.reset()\n", | |
"preprocessed_reference.rename_labels(generator='int')" | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
"Note how the small gap between the first two speech turns have been removed.\n", | |
"Note also how the overlapping segments at the end have been resegmented: the point is to not miss any boundaries." | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
"Then, hypothesis is also preprocessed to only consider speech regions, as this is speaker change detection that we are evaluating: speech to non-speech changes are not considered. It would probably be different if we were to evaluate the actual change detection with precision and recall metrics (see final note)." | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 13, | |
"metadata": { | |
"collapsed": false | |
}, | |
"outputs": [ | |
{ | |
"data": { | |
"image/png": "iVBORw0KGgoAAAANSUhEUgAABHEAAAC7CAYAAADi1AKAAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAADrFJREFUeJzt3XusZWdZBvDnpYPhUgGxF3BaGSRcWisUGEgBA1JQ0JKZ\nEkxKBYJRAybcNEQFjLT8o00kIEYCJUVabCkYLm0VpSVoQLQVZiq0lFouRWnHQsErFRRoX//Yu2Gc\n0sw503VmzbfP75fs7L3W7Dl51smXOXue833fqu4OAAAAAIe2u80dAAAAAID9U+IAAAAADECJAwAA\nADAAJQ4AAADAAJQ4AAAAAANQ4gAAAAAMQIkDAAAAMAAlDgAAAMAAlDgAAAAAA1DiAAAAAAxgyBKn\nqk6tqq6qR8ydZUpV9YCqendVfbGqdlfVX1TVw+bONYWqurWqPrXX41VzZ5rK97m2bXNnmkJVHV1V\n76qq65fj8fKqevbcuQAAADarLXMHOECnJ/n48vmMmbNMoqoqyQeSnNfdz12ee1SSo5N8bs5sE/lW\nd584d4gNsnLXthyPF2UxHn9hee5BSXbMGgwAAGATq+6eO8O6VNXhSa5L8tQkf9bdD5850iSq6uQk\nZ3b3k+fOshGq6pbuPnzuHBthFa+tqp6W5LXd/ZS5swAAALAw4nKqnUk+1N2fS/KvVfXYuQNN5IQk\nu+cOsYHuuc+So9PmDjShva/tA3OHmciPJ7ly7hAAAAB8z11aTrVn67GTTuPZuueGWsPbTk/ypuXr\ndy+PJy8/dlx0yqTXdsmpH1zLtR0cZ9a006/O7LVc20FacrR94qllu2a/tgtPO27Sazr9PdeueyxW\n1ZuT/GSSb3f346bMAwAAwNoMtSdOVd0/yclJfqKqOslhSbqqfqNHWxd2R9ck+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394TJAAAAAElFTkSuQmCC\n", | |
"text/plain": [ | |
"<pyannote.core.annotation.Annotation at 0x11309f6d8>" | |
] | |
}, | |
"execution_count": 13, | |
"metadata": {}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"notebook.reset()\n", | |
"preprocessed_hypothesis" | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
"Purity and coverage are then computed based on their coocurrence duration matrix:" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 14, | |
"metadata": { | |
"collapsed": false | |
}, | |
"outputs": [ | |
{ | |
"data": { | |
"text/html": [ | |
"<div>\n", | |
"<table border=\"1\" class=\"dataframe\">\n", | |
" <thead>\n", | |
" <tr style=\"text-align: right;\">\n", | |
" <th>j</th>\n", | |
" <th>0</th>\n", | |
" <th>1</th>\n", | |
" <th>2</th>\n", | |
" <th>3</th>\n", | |
" <th>4</th>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>i</th>\n", | |
" <th></th>\n", | |
" <th></th>\n", | |
" <th></th>\n", | |
" <th></th>\n", | |
" <th></th>\n", | |
" </tr>\n", | |
" </thead>\n", | |
" <tbody>\n", | |
" <tr>\n", | |
" <th>A</th>\n", | |
" <td>2.0</td>\n", | |
" <td>0.0</td>\n", | |
" <td>0.0</td>\n", | |
" <td>0.0</td>\n", | |
" <td>0.0</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>B</th>\n", | |
" <td>2.0</td>\n", | |
" <td>0.0</td>\n", | |
" <td>0.0</td>\n", | |
" <td>0.0</td>\n", | |
" <td>0.0</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>C</th>\n", | |
" <td>1.0</td>\n", | |
" <td>0.0</td>\n", | |
" <td>0.0</td>\n", | |
" <td>0.0</td>\n", | |
" <td>0.0</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>D</th>\n", | |
" <td>1.0</td>\n", | |
" <td>0.0</td>\n", | |
" <td>0.0</td>\n", | |
" <td>0.0</td>\n", | |
" <td>0.0</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>E</th>\n", | |
" <td>0.0</td>\n", | |
" <td>1.0</td>\n", | |
" <td>0.0</td>\n", | |
" <td>0.0</td>\n", | |
" <td>0.0</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>F</th>\n", | |
" <td>0.0</td>\n", | |
" <td>0.0</td>\n", | |
" <td>1.0</td>\n", | |
" <td>1.0</td>\n", | |
" <td>0.0</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>G</th>\n", | |
" <td>0.0</td>\n", | |
" <td>0.0</td>\n", | |
" <td>0.0</td>\n", | |
" <td>1.0</td>\n", | |
" <td>1.0</td>\n", | |
" </tr>\n", | |
" </tbody>\n", | |
"</table>\n", | |
"</div>" | |
], | |
"text/plain": [ | |
"j 0 1 2 3 4\n", | |
"i \n", | |
"A 2.0 0.0 0.0 0.0 0.0\n", | |
"B 2.0 0.0 0.0 0.0 0.0\n", | |
"C 1.0 0.0 0.0 0.0 0.0\n", | |
"D 1.0 0.0 0.0 0.0 0.0\n", | |
"E 0.0 1.0 0.0 0.0 0.0\n", | |
"F 0.0 0.0 1.0 1.0 0.0\n", | |
"G 0.0 0.0 0.0 1.0 1.0" | |
] | |
}, | |
"execution_count": 14, | |
"metadata": {}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"K = (preprocessed_hypothesis * preprocessed_reference.rename_labels(generator='int')).to_pandas()\n", | |
"K" | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
"For each segment in hypothesis, we get the duration of the most coocurring reference segment..." | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 15, | |
"metadata": { | |
"collapsed": false | |
}, | |
"outputs": [ | |
{ | |
"data": { | |
"text/plain": [ | |
"i\n", | |
"A 2.0\n", | |
"B 2.0\n", | |
"C 1.0\n", | |
"D 1.0\n", | |
"E 1.0\n", | |
"F 1.0\n", | |
"G 1.0\n", | |
"dtype: float64" | |
] | |
}, | |
"execution_count": 15, | |
"metadata": {}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"K.max(axis=1)" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 16, | |
"metadata": { | |
"collapsed": false | |
}, | |
"outputs": [ | |
{ | |
"data": { | |
"text/plain": [ | |
"9.0" | |
] | |
}, | |
"execution_count": 16, | |
"metadata": {}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"K.max(axis=1).sum()" | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
"... and divide by the overal hypothesis duration" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 17, | |
"metadata": { | |
"collapsed": false | |
}, | |
"outputs": [ | |
{ | |
"data": { | |
"text/plain": [ | |
"{'intersection duration': 9.0, 'total duration': 11.0}" | |
] | |
}, | |
"execution_count": 17, | |
"metadata": {}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"components = purity._process(preprocessed_hypothesis, preprocessed_reference)\n", | |
"components" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 18, | |
"metadata": { | |
"collapsed": false | |
}, | |
"outputs": [ | |
{ | |
"data": { | |
"text/plain": [ | |
"0.8181818181818182" | |
] | |
}, | |
"execution_count": 18, | |
"metadata": {}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"components['intersection duration'] / components['total duration']" | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
"Coverage is the dual metric where the roles of reference and hypothesis are interchanged:" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 19, | |
"metadata": { | |
"collapsed": false | |
}, | |
"outputs": [ | |
{ | |
"data": { | |
"text/plain": [ | |
"j\n", | |
"0 2.0\n", | |
"1 1.0\n", | |
"2 1.0\n", | |
"3 1.0\n", | |
"4 1.0\n", | |
"dtype: float64" | |
] | |
}, | |
"execution_count": 19, | |
"metadata": {}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"K.max(axis=0)" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 41, | |
"metadata": { | |
"collapsed": false | |
}, | |
"outputs": [ | |
{ | |
"data": { | |
"text/plain": [ | |
"6.0" | |
] | |
}, | |
"execution_count": 41, | |
"metadata": {}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"K.max(axis=0).sum()" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 21, | |
"metadata": { | |
"collapsed": false | |
}, | |
"outputs": [ | |
{ | |
"data": { | |
"text/plain": [ | |
"{'intersection duration': 6.0, 'total duration': 11.0}" | |
] | |
}, | |
"execution_count": 21, | |
"metadata": {}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"components = coverage._process(preprocessed_reference, preprocessed_hypothesis)\n", | |
"components" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 22, | |
"metadata": { | |
"collapsed": false | |
}, | |
"outputs": [ | |
{ | |
"data": { | |
"text/plain": [ | |
"0.5454545454545454" | |
] | |
}, | |
"execution_count": 22, | |
"metadata": {}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"components['intersection duration'] / components['total duration']" | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
"## Final note: why not use precision & recall?" | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
"`pyannote.metrics` does implement `SegmentationPrecision` and `SegmentationRecall` metrics.\n", | |
"Three reasons explains why we'd rather use purity and coverage:\n", | |
" 1. precision and recall are very sensitive to the `tolerance` parameter.\n", | |
" 2. purity and coverage can also be used for evaluating subsequent steps of the speaker diarization pipeline (which is very convenient to evaluate the impact of each step)\n", | |
" 3. it is not clear what to do with speech/non-speech boundaries with precision and recall. purity and coverage are not impacted with this issue.\n" | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
"### Impact of `tolerance` parameter" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 40, | |
"metadata": { | |
"collapsed": false | |
}, | |
"outputs": [ | |
{ | |
"data": { | |
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAagAAAEYCAYAAAAJeGK1AAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAIABJREFUeJzt3XuUXGWZ7/HvL50bISEhdAghF5r7TUAgRsBbVFBAIDji\nMTiCsNRwdBjUWTozOgx6XOMM6jjeZ5BBDgEV8ARlksgdBMUYSAdJyAUwYO63JoFcSEjS3c/5Y7/R\nSttJVzfVtXd1/z5r1UrV3m9VPbUrTz97v/utdysiMDMzK5o+eQdgZmbWHhcoMzMrJBcoMzMrJBco\nMzMrJBcoMzMrJBcoMzMrJBeoHkbSOElbJdXlHYuZ2evhAlUQkpZK2p6KyzpJt0ga3NnXiYjlETE4\nIlrS6z4q6eOVj9isuiR9WFJjypE1ku6V9Na847Lu4wJVLBdGxGDgNGA8cG1nniypb7dEZZYzSX8H\nfBv4V2AkMA74T2BSld5fkvz3ssq8wQsoIlYB9wJvSEdWZ+9eJ+nLkn6c7jdICkkfk7QceKRkWV9J\nXwXeBnw/7XV+X9IPJH2z9P0kTZf02Sp+RLOySRoKfAX4m4j4eUS8GhG7ImJGRHxe0gBJ35a0Ot2+\nLWlAeu5iSReUvFZfSU2STkuPz5A0S9IrkuZJmljS9lFJX5X0W2AbcISkK9NrbpH0oqSr2sT69+no\nbrWkj6dcPCqtGyDp3yUtT70kN0jar9s3YA1zgSogSWOB84Hfl/mUdwDHA+8tXRgR/wT8Brg6dftd\nDUwFLt29NyipHjgb+GmFwjertDOBgcAv9rL+n4AzgDcCpwAT+HPvw+3ApSVt3wu8FBFPSRoN/BL4\nF2A48DngLkkjStpfBkwBhgDLgPXABcABwJXAt0qK3bnA35Hl01HAxDZxXg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9YX5mPa9ZtnEs9lAtUsQn424i4f4+F0kSyvb7Sx2cDZ0bENkmPAgPT6l2RduGAFvb9\nnQuYGhFfqEj0ZsXhXKpBPgdVXVvILocM8BvgQ6lvfATZZZ2fbNP+frJJIPsBSDpG0v7tvO5Q4OWU\nUMeRXU65Iw8Dn0yvWydpaFp2iaSD0/Lhkg7r3Ec0qwrnUi/gAlVFEbEB+G0a+nomWRfEPOAR4O8j\nYm2bp9xEduL2qfScH9L+Xtt9QF9Ji8lOHs8uI5xPA++U9AxZd8UJEbEIuBZ4QNJ8sn79XC5zbbYv\nzqXewbOZm5lZIfkIyszMCskFyszMCskFyszMCskFyszMCskFyszMCskFyszMCskFyszMCun/A6sr\nZtqvAkKOAAAAAElFTkSuQmCC\n", | |
"text/plain": [ | |
"<matplotlib.figure.Figure at 0x112c6a1d0>" | |
] | |
}, | |
"metadata": {}, | |
"output_type": "display_data" | |
} | |
], | |
"source": [ | |
"subplot(221)\n", | |
"plot(np.linspace(0, 2, 10), [SegmentationPurity(tolerance=tolerance)(reference, hypothesis) for tolerance in np.linspace(0, 2, 10)])\n", | |
"xlabel('tolerance'), xlim(0, 2), ylim(0, 1.1), title('Purity');\n", | |
"subplot(222)\n", | |
"plot(np.linspace(0, 2, 10), [SegmentationCoverage(tolerance=tolerance)(reference, hypothesis) for tolerance in np.linspace(0, 2, 10)])\n", | |
"xlabel('tolerance'), xlim(0, 2), ylim(0, 1.1), title('Coverage');\n", | |
"subplot(223)\n", | |
"plot(np.linspace(0, 2, 10), [SegmentationPrecision(tolerance=tolerance)(reference, hypothesis) for tolerance in np.linspace(0, 2, 10)])\n", | |
"xlabel('tolerance'), xlim(0, 2), ylim(0, 1.1), title('Precision');\n", | |
"subplot(224)\n", | |
"plot(np.linspace(0, 2, 10), [SegmentationRecall(tolerance=tolerance)(reference, hypothesis) for tolerance in np.linspace(0, 2, 10)])\n", | |
"xlabel('tolerance'), xlim(0, 2), ylim(0, 1.1), title('Recall');\n", | |
"tight_layout()" | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
"Purity and coverage are much more stable..." | |
] | |
} | |
], | |
"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.4.3" | |
} | |
}, | |
"nbformat": 4, | |
"nbformat_minor": 2 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment