Beispiel #1
0
    def _get_ref_mos(dataset_reader, mos):
        ref_mos = []
        for dis_video in dataset_reader.dataset.dis_videos:
            # get the dis video's ref video's mos
            curr_content_id = dis_video['content_id']
            ref_indices = indices(
                zip(dataset_reader.content_id_of_dis_videos,
                    dataset_reader.disvideo_is_refvideo),
                lambda content_ref_pair: content_ref_pair[
                    1] and content_ref_pair[0] == curr_content_id)
            assert len(ref_indices) == 1, \
                'Should have only and one ref video for a dis video, ' \
                'but got {}'.format(len(ref_indices))
            ref_idx = ref_indices[0]

            ref_mos.append(mos[ref_idx])
        return np.array(ref_mos)
 def test_disvideo_is_refvideo(self):
     l = self.dataset_reader.disvideo_is_refvideo
     self.assertItemsEqual(indices(l, lambda e: e is True), range(7))