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

14 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 Caspeal 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 

16 

17rc = UserDefaults("bobrc.toml") 

18 

19 

20class CaspealDatabase(CSVDatabase): 

21 """ 

22 The CAS-PEAL database consists of several ten thousand images of Chinese people (CAS = Chinese Academy of Science). 

23 Overall, there are 1040 identities contained in the database. 

24 For these identities, images with different Pose, Expression, Aging and Lighting (PEAL) conditions, as well as accessories, image backgrounds and camera distances are provided. 

25 

26 Included in the database, there are file lists defining identification experiments. 

27 All the experiments rely on a gallery that consists of the frontal and frontally illuminated images with neutral expression and no accessories. 

28 For each of the variations, probe sets including exactly that variation are available. 

29 

30 The training set consists of a subset of the frontal images (some images are both in the training and in the development set). 

31 This also means that there is no training set defined for the pose images. 

32 Additionally, the database defines only a development set, but no evaluation set. 

33 

34 This package only contains the Bob_ accessor methods to use the DB directly from python, with our certified protocols. 

35 We have implemented the default face identification protocols ``'accessory'``, ``'aging'``, ``'background'``, ``'distance'``, ``'expression'`` and ``'lighting'``. 

36 We do not provide the ``'pose'`` protocol (yet) since the training set of the `CAS-PEAL <http://www.jdl.ac.cn/peal/files/IEEE_SMC_A_gao_CAS-PEAL.pdf>`_ 

37 database does not contain pose images: 

38 

39 

40 .. code-block:: latex 

41 

42 @article{gao2007cas, 

43 title={The CAS-PEAL large-scale Chinese face database and baseline evaluations}, 

44 author={Gao, Wen and Cao, Bo and Shan, Shiguang and Chen, Xilin and Zhou, Delong and Zhang, Xiaohua and Zhao, Debin}, 

45 journal={IEEE Transactions on Systems, Man, and Cybernetics-Part A: Systems and Humans}, 

46 volume={38}, 

47 number={1}, 

48 pages={149--161}, 

49 year={2007}, 

50 publisher={IEEE} 

51 } 

52 

53 """ 

54 

55 name = "caspeal" 

56 category = "face" 

57 dataset_protocols_name = "caspeal.tar.gz" 

58 dataset_protocols_urls = [ 

59 "https://www.idiap.ch/software/bob/databases/latest/face/caspeal-9ce68f00.tar.gz", 

60 "http://www.idiap.ch/software/bob/databases/latest/face/caspeal-9ce68f00.tar.gz", 

61 ] 

62 

63 dataset_protocols_hash = "9ce68f00" 

64 

65 def __init__( 

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

67 ): 

68 super().__init__( 

69 name=self.name, 

70 protocol=protocol, 

71 transformer=make_pipeline( 

72 FileSampleLoader( 

73 data_loader=bob.io.base.load, 

74 dataset_original_directory=rc.get( 

75 "bob.bio.face.caspeal.directory", "" 

76 ), 

77 extension=rc.get("bob.bio.face.caspeal.extension", ".tif"), 

78 ), 

79 EyesAnnotations(), 

80 ), 

81 annotation_type=annotation_type, 

82 fixed_positions=fixed_positions, 

83 )