I am reading two RTTM files. One is a reference and another is a hypothesis after Audio Diarization. The documentation ( https://pyannote.github.io/pyannote-metrics/basics.html#evaluation-map ) shows the manual annotation where the developer has to write all the data in the program but I want to read the data from the RTTM file. If we follow the documentation and use the code given below.
In [1]: from pyannote.core import Segment, Timeline, Annotation
In [2]: reference = Annotation(uri='file1')
...: reference[Segment(0, 10)] = 'A'
...: reference[Segment(12, 20)] = 'B'
...: reference[Segment(24, 27)] = 'A'
...: reference[Segment(30, 40)] = 'C'
...:
In [3]: hypothesis = Annotation(uri='file1')
...: hypothesis[Segment(2, 13)] = 'a'
...: hypothesis[Segment(13, 14)] = 'd'
...: hypothesis[Segment(14, 20)] = 'b'
...: hypothesis[Segment(22, 38)] = 'c'
...: hypothesis[Segment(38, 40)] = 'd'
It stores the data into two variables which are reference and hypothesis. When I use my own data as input in Segment as given below.
reference = Annotation()
for i in range(0,len(org_start)):
reference[Segment(org_start[i], org_end[i])] = org_lab[i]
hypothesis - Annotation()
for i in range(0,len(res_start)):
hypothesis[Segment(res_start[i],res_end[i])] = res_lab[i]
It is only storing the first row data from RTTM file. I think there is an issue in the Segment function because it's only storing the first value. I want to store all the values present in res_start, res_end and res_lab into hypothesis. Same process for refrence.
Aucun commentaire:
Enregistrer un commentaire