Coverage for src/bob/bio/base/annotator/Annotator.py: 83%

6 statements  

« prev     ^ index     » next       coverage.py v7.6.5, created at 2024-11-14 21:41 +0100

1from sklearn.base import BaseEstimator, TransformerMixin 

2 

3 

4class Annotator(TransformerMixin, BaseEstimator): 

5 """Annotator class for all annotators. This class is meant to be used in 

6 conjunction with the bob bio annotate script or to be used in pipelines. 

7 """ 

8 

9 def transform(self, samples, **kwargs): 

10 """Annotates a sample and returns annotations in a dictionary. 

11 

12 Parameters 

13 ---------- 

14 samples : numpy.ndarray 

15 The samples that are being annotated. 

16 **kwargs 

17 The extra arguments that may be passed. 

18 

19 Returns 

20 ------- 

21 dict 

22 A dictionary containing the annotations of the biometric sample. If 

23 the program fails to annotate the sample, it should return an empty 

24 dictionary. 

25 """ 

26 raise NotImplementedError 

27 

28 # Alias call to transform 

29 def __call__(self, samples, **kwargs): 

30 return self.transform(samples, **kwargs)