pyannote / pyannote-metrics

A toolkit for reproducible evaluation, diagnostic, and error analysis of speaker diarization systems
http://pyannote.github.io/pyannote-metrics
MIT License
186 stars 33 forks source link

Leading zeros in decimal integer literals are not permitted; use an 0o prefix for octal integers #60

Closed mkr00 closed 2 years ago

mkr00 commented 2 years ago

Hello,

I would like to ask if anyone could advise me on how to solve my problem. I tried to use pyannote-metrics to calculate DER for my diarization. And it gave me the following error:

$ python newder.py File "newder.py", line 114 hypothesis[Segment(21,990, 27,030)] = '2' ^

I also enclose the code which I used.

from pyannote.metrics.diarization import DiarizationErrorRate from pyannote.core import Annotation, Segment

reference = Annotation() reference[Segment(17.504, 21.235)] = 'B' reference[Segment(21.916, 26.328)] = 'A' reference[Segment(27.150, 29.119)] = 'B' reference[Segment(29.119, 30.238)] = 'A' reference[Segment(34.960, 40.866)] = 'B' reference[Segment(41.923, 49.295)] = 'A' reference[Segment(49.295, 56.103)] = 'B' reference[Segment(59.979, 67.848)] = 'A' reference[Segment(69.108, 75.813)] = 'B' reference[Segment(166.275, 170.946)] = 'B' reference[Segment(171.559, 176.274)] = 'A' reference[Segment(177.493, 181.652)] = 'B' reference[Segment(181.652, 183.780)] = 'B' reference[Segment(291.748, 299.570)] = 'B' reference[Segment(299.570, 306.240)] = 'B' reference[Segment(306.240, 307.974)] = 'B' reference[Segment(348.352, 354.697)] = 'A' reference[Segment(354.697, 361.050)] = 'A' reference[Segment(855.643, 858.856)] = 'B' reference[Segment(859.457, 863.143)] = 'A' reference[Segment(863.143, 865.002)] = 'B' reference[Segment(942.978, 948.349)] = 'A' reference[Segment(948.606, 954.402)] = 'B' reference[Segment(1032.074, 1037.559)] = 'A' reference[Segment(1038.529, 1043.970)] = 'B' reference[Segment(1117.093, 1125.034)] = 'B' reference[Segment(1125.034, 1130.235)] = 'B' reference[Segment(1217.991, 1223.830)] = 'B' reference[Segment(1223.830, 1230.850)] = 'A' reference[Segment(1328.235, 1333.799)] = 'A' reference[Segment(1334.513, 1341.996)] = 'B' reference[Segment(1412.528, 1420.779)] = 'B' reference[Segment(1420.779, 1425.211)] = 'B' reference[Segment(1508.792, 1513.704)] = 'A' reference[Segment(1513.704, 1520.848)] = 'A' reference[Segment(1520.848, 1524.327)] = 'A' reference[Segment(1617.036, 1620.899)] = 'B' reference[Segment(1620.899, 1623.803)] = 'B' reference[Segment(1624.598, 1632.810)] = 'A' reference[Segment(1632.810, 1636.273)] = 'B' reference[Segment(1725.707, 1730.333)] = 'A' reference[Segment(1730.333, 1734.399)] = 'A' reference[Segment(1734.899, 1741.170)] = 'B' reference[Segment(1832.367, 1838.520)] = 'B' reference[Segment(1838.520, 1848.240)] = 'B' reference[Segment(1959.258, 1964.409)] = 'A' reference[Segment(1964.409, 1970.215)] = 'A' reference[Segment(1970.215, 1976.569)] = 'A' reference[Segment(2099.167, 2105.701)] = 'A' reference[Segment(2105.701, 2112.204)] = 'A' reference[Segment(2230.448, 2237.078)] = 'B' reference[Segment(2237.078, 2241.732)] = 'B' reference[Segment(2314.025, 2317.460)] = 'B' reference[Segment(2318.210, 2324.440)] = 'A' reference[Segment(2324.440, 2328.606)] = 'B' reference[Segment(2412.247, 2421.357)] = 'A' reference[Segment(2421.357, 2423.956)] = 'A' reference[Segment(2549.738, 2555.557)] = 'B' reference[Segment(2555.557, 2559.237)] = 'B' reference[Segment(2650.348, 2654.545)] = 'A' reference[Segment(2654.545, 2660.840)] = 'A' reference[Segment(2660.840, 2662.934)] = 'A' reference[Segment(2757.164, 2765.416)] = 'B' reference[Segment(2765.416, 2769.595)] = 'B' reference[Segment(2842.332, 2848.685)] = 'A' reference[Segment(2848.685, 2853.377)] = 'A' reference[Segment(2853.377, 2857.497)] = 'A' reference[Segment(2940.100, 2947.445)] = 'B' reference[Segment(2947.445, 2952.070)] = 'B' reference[Segment(3029.085, 3035.359)] = 'A' reference[Segment(3035.359, 3042.682)] = 'A' reference[Segment(3134.404, 3145.159)] = 'B' reference[Segment(3145.159, 3148.765)] = 'B' reference[Segment(3250.736, 3252.691)] = 'B' reference[Segment(3252.691, 3257.664)] = 'A' reference[Segment(3257.664, 3261.000)] = 'B' reference[Segment(3324.893, 3331.474)] = 'A' reference[Segment(3331.474, 3333.935)] = 'A' reference[Segment(3334.778, 3342.040)] = 'B' reference[Segment(3343.547, 3347.029)] = 'A' reference[Segment(3347.029, 3349.234)] = 'B' reference[Segment(3580.757, 3584.779)] = 'C' reference[Segment(3584.779, 3590.813)] = 'C' reference[Segment(3657.000, 3664.170)] = 'C' reference[Segment(3735.395, 3742.644)] = 'C' reference[Segment(3742.644, 3746.544)] = 'C' reference[Segment(3821.163, 3826.814)] = 'C' reference[Segment(3826.814, 3834.588)] = 'C' reference[Segment(3879.009, 3883.659)] = 'C' reference[Segment(3883.659, 3887.438)] = 'C' reference[Segment(3887.438, 3890.542)] = 'C' reference[Segment(3949.520, 3953.697)] = 'C' reference[Segment(3953.697, 3959.302)] = 'C' reference[Segment(4023.878, 4029.113)] = 'C' reference[Segment(4029.113, 4034.514)] = 'C' reference[Segment(4068.919, 4073.487)] = 'C' reference[Segment(4073.487, 4078.203)] = 'C' reference[Segment(4078.203, 4081.995)] = 'C' reference[Segment(4149.261, 4157.527)] = 'C' reference[Segment(4157.527, 4160.030)] = 'C' reference[Segment(4216.106, 4219.796)] = 'C' reference[Segment(4219.796, 4224.351)] = 'C' reference[Segment(4224.351, 4226.050)] = 'C' reference[Segment(4252.291, 4256.421)] = 'C' reference[Segment(4256.421, 4257.177)] = 'C' reference

hypothesis = Annotation() hypothesis[Segment(17,310, 21,990)] = '15' hypothesis[Segment(21,990, 27,030)] = '2' hypothesis[Segment(27,030, 29,190)] = '15' hypothesis[Segment(29,190, 31,420)] = '2' hypothesis[Segment(32,700, 34,500)] = '2' hypothesis[Segment(34,500, 41,220)] = '15' hypothesis[Segment(41,220, 49,380)] = '2' hypothesis[Segment(49,380, 56,580)] = '15' hypothesis[Segment(56,580, 57,300)] = '2' hypothesis[Segment(59,170, 68,890)] = '2' hypothesis[Segment(68,890, 76,660)] = '15' hypothesis[Segment(165,500, 171,140)] = '15' hypothesis[Segment(171,140, 177,140)] = '2' hypothesis[Segment(177,140, 184,960)] = '15' hypothesis[Segment(291,460, 309,250)] = '15' hypothesis[Segment(347,230, 361,290)] = '2' hypothesis[Segment(361,400, 361,840)] = '2' hypothesis[Segment(855,490, 859,210)] = '15' hypothesis[Segment(859,210, 862,810)] = '2' hypothesis[Segment(862,810, 866,040)] = '15' hypothesis[Segment(942,710, 948,830)] = '2' hypothesis[Segment(948,830, 954,590)] = '15' hypothesis[Segment(954,590, 955,410)] = '2' hypothesis[Segment(1031,690, 1038,530)] = '2' hypothesis[Segment(1038,530, 1045,370)] = '15' hypothesis[Segment(1116,810, 1131,100)] = '15' hypothesis[Segment(1217,820, 1223,940)] = '15' hypothesis[Segment(1223,940, 1232,240)] = '2' hypothesis[Segment(1328,040, 1334,400)] = '2' hypothesis[Segment(1334,400, 1343,340)] = '15' hypothesis[Segment(1411,890, 1426,290)] = '15' hypothesis[Segment(1508,540, 1525,260)] = '2' hypothesis[Segment(1616,450, 1624,250)] = '15' hypothesis[Segment(1624,250, 1632,410)] = '2' hypothesis[Segment(1632,410, 1637,440)] = '15' hypothesis[Segment(1725,470, 1734,710)] = '2' hypothesis[Segment(1734,710, 1741,220)] = '15' hypothesis[Segment(1832,130, 1849,160)] = '15' hypothesis[Segment(1958,640, 1976,730)] = '2' hypothesis[Segment(2098,490, 2113,190)] = '2' hypothesis[Segment(2230,220, 2242,890)] = '15' hypothesis[Segment(2313,370, 2317,810)] = '15' hypothesis[Segment(2317,810, 2324,530)] = '2' hypothesis[Segment(2324,530, 2329,410)] = '15' hypothesis[Segment(2411,970, 2424,820)] = '2' hypothesis[Segment(2549,330, 2560,390)] = '15' hypothesis[Segment(2650,150, 2664,110)] = '2' hypothesis[Segment(2756,190, 2770,930)] = '15' hypothesis[Segment(2842,140, 2858,350)] = '2' hypothesis[Segment(2939,870, 2953,120)] = '15' hypothesis[Segment(3028,210, 3042,750)] = '2' hypothesis[Segment(3134,230, 3134,910)] = '2' hypothesis[Segment(3135,130, 3150,290)] = '15' hypothesis[Segment(3250,380, 3252,660)] = '15' hypothesis[Segment(3252,660, 3257,700)] = '2' hypothesis[Segment(3257,700, 3261,540)] = '15' hypothesis[Segment(3261,540, 3262,170)] = '2' hypothesis[Segment(3324,740, 3334,940)] = '2' hypothesis[Segment(3334,940, 3343,100)] = '15' hypothesis[Segment(3343,100, 3347,180)] = '2' hypothesis[Segment(3347,180, 3350,410)] = '15' hypothesis[Segment(3579,160, 3580,030)] = '2' hypothesis[Segment(3580,560, 3591,000)] = '11' hypothesis[Segment(3656,700, 3664,460)] = '11' hypothesis[Segment(3733,540, 3734,760)] = '2' hypothesis[Segment(3735,170, 3746,740)] = '11' hypothesis[Segment(3746,970, 3747,680)] = '11' hypothesis[Segment(3820,960, 3835,760)] = '11' hypothesis[Segment(3878,850, 3890,860)] = '11' hypothesis[Segment(3948,330, 3960,390)] = '11' hypothesis[Segment(4022,340, 4023,570)] = '11' hypothesis[Segment(4023,650, 4034,640)] = '11' hypothesis[Segment(4067,720, 4082,330)] = '11' hypothesis[Segment(4082,430, 4083,160)] = '11' hypothesis[Segment(4147,970, 4160,340)] = '11' hypothesis[Segment(4160,880, 4161,530)] = '11' hypothesis[Segment(4215,400, 4226,850)] = '11' hypothesis[Segment(4250,940, 4258,120)] = '11' hypothesis

diarizationErrorRate = DiarizationErrorRate() print("DER = {0:.3f}".format(diarizationErrorRate(reference, hypothesis, uem=Segment(17.504, 4257.177))))

Thank you for every help.

BR mkr00

hbredin commented 2 years ago

The error message says it all:

 hypothesis[Segment(17,310, 21,990)] = '15'

You used a comma , instead of a dot . as decimal separator.