Coverage for src/bob/bio/face/database/frgc.py: 100%

16 statements  

« prev     ^ index     » next       coverage.py v7.6.0, created at 2024-07-13 00:04 +0200

1#!/usr/bin/env python 

2# vim: set fileencoding=utf-8 : 

3# Tiago de Freitas Pereira <tiago.pereira@idiap.ch> 

4 

5""" 

6 FRGC database implementation 

7""" 

8 

9from clapper.rc import UserDefaults 

10from sklearn.pipeline import make_pipeline 

11 

12import bob.io.base 

13 

14from bob.bio.base.database import CSVDatabase, FileSampleLoader 

15from bob.bio.face.database.sample_loaders import EyesAnnotations 

16from bob.pipelines import hash_string 

17 

18rc = UserDefaults("bobrc.toml") 

19 

20 

21class FRGCDatabase(CSVDatabase): 

22 """ 

23 Face Recognition Grand Test dataset 

24 """ 

25 

26 name = "frgc" 

27 category = "face" 

28 dataset_protocols_name = "frgc.tar.gz" 

29 dataset_protocols_urls = [ 

30 "https://www.idiap.ch/software/bob/databases/latest/face/frgc-294a2ce4.tar.gz", 

31 "http://www.idiap.ch/software/bob/databases/latest/face/frgc-294a2ce4.tar.gz", 

32 ] 

33 dataset_protocols_hash = "294a2ce4" 

34 

35 def __init__( 

36 self, protocol, annotation_type="eyes-center", fixed_positions=None 

37 ): 

38 super().__init__( 

39 name=self.name, 

40 protocol=protocol, 

41 transformer=make_pipeline( 

42 FileSampleLoader( 

43 data_loader=bob.io.base.load, 

44 dataset_original_directory=rc.get( 

45 "bob.bio.face.frgc.directory", # TODO normalize this name 

46 "", 

47 ), 

48 extension=rc.get("bob.bio.face.frgc.extension", ""), 

49 ), 

50 EyesAnnotations(), 

51 ), 

52 annotation_type=annotation_type, 

53 fixed_positions=fixed_positions, 

54 score_all_vs_all=True, 

55 memory_demanding=True, 

56 ) 

57 

58 self.hash_fn = hash_string