Coverage for src/bob/bio/face/database/multipie.py: 100%
14 statements
« prev ^ index » next coverage.py v7.6.0, created at 2024-07-13 00:04 +0200
« 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>
5"""
6 Multipie database implementation
7"""
9from clapper.rc import UserDefaults
10from sklearn.pipeline import make_pipeline
12import bob.io.base
14from bob.bio.base.database import CSVDatabase, FileSampleLoader
15from bob.bio.face.database.sample_loaders import MultiposeAnnotations
17rc = UserDefaults("bobrc.toml")
20class MultipieDatabase(CSVDatabase):
21 """
23 The `CMU Multi-PIE face database <http://www.cs.cmu.edu/afs/cs/project/PIE/MultiPie/Multi-Pie/Home.html>`_ contains more than 750,000 images
24 of 337 people recorded in up to four sessions over the span of five months. Subjects were imaged under 15 view points and 19 illumination
25 conditions while displaying a range of facial expressions. In addition, high resolution frontal images were acquired as well.
26 In total, the database contains more than 305 GB of face data.
28 The data has been recorded over 4 sessions. For each session, the subjects were asked to display a few
29 different expressions. For each of those expressions, a complete set of 30 pictures is captured that includes
30 15 different view points times 20 different illumination conditions (18 with various flashes, plus 2 pictures with no flash at all).
33 .. warning::
35 To use this dataset protocol, you need to have the original files of the Multipie dataset.
36 Once you have it downloaded, please run the following command to set the path for Bob
38 .. code-block:: sh
40 bob config set bob.db.multipie.directory [MULTIPIE PATH]
43 Available expressions:
45 - Session 1 : *neutral*, *smile*
46 - Session 2 : *neutral*, *surprise*, *squint*
47 - Session 3 : *neutral*, *smile*, *disgust*
48 - Session 4 : *neutral*, *neutral*, *scream*.
50 Camera and flash positioning:
52 The different view points are obtained by a set of 13 cameras located at head height, spaced at 15° intervals,
53 from the -90° to the 90° angle, plus 2 additional cameras located above the subject to simulate a typical
54 surveillance view. A flash coincides with each camera, and 3 additional flashes are positioned above the subject, for a total
55 of 18 different possible flashes.
57 Protocols:
59 **Expression protocol**
61 **Protocol E**
63 * Only frontal view (camera 05_1); only no-flash (shot 0)
64 * Enrolled : 1x neutral expression (session 1; recording 1)
65 * Probes : 4x neutral expression + other expressions (session 2, 3, 4; all recordings)
67 **Pose protocol**
69 **Protocol P**
71 * Only neutral expression (recording 1 from each session, + recording 2 from session 4); only no-flash (shot 0)
72 * Enrolled : 1x frontal view (session 1; camera 05_1)
73 * Probes : all views from cameras at head height (i.e excluding 08_1 and 19_1), including camera 05_1 from session 2,3,4.
75 **Illumination protocols**
77 N.B : shot 19 is never used in those protocols as it is redundant with shot 0 (both are no-flash).
79 **Protocol M**
81 * Only frontal view (camera 05_1); only neutral expression (recording 1 from each session, + recording 2 from session 4)
82 * Enrolled : no-flash (session 1; shot 0)
83 * Probes : no-flash (session 2, 3, 4; shot 0)
85 **Protocol U**
87 * Only frontal view (camera 05_1); only neutral expression (recording 1 from each session, + recording 2 from session 4)
88 * Enrolled : no-flash (session 1; shot 0)
89 * Probes : all shots from session 2, 3, 4, including shot 0.
91 **Protocol G**
93 * Only frontal view (camera 05_1); only neutral expression (recording 1 from each session, + recording 2 from session 4)
94 * Enrolled : all shots (session 1; all shots)
95 * Probes : all shots from session 2, 3, 4.
100 """
102 name = "multipie"
103 category = "face"
104 dataset_protocols_name = "multipie.tar.gz"
105 dataset_protocols_urls = [
106 "https://www.idiap.ch/software/bob/databases/latest/face/multipie-39e3437d.tar.gz",
107 "http://www.idiap.ch/software/bob/databases/latest/face/multipie-39e3437d.tar.gz",
108 ]
109 dataset_protocols_hash = "39e3437d"
111 def __init__(
112 self,
113 protocol,
114 annotation_type=("eyes-center", "left-profile", "right-profile"),
115 fixed_positions=None,
116 ):
117 super().__init__(
118 name=self.name,
119 protocol=protocol,
120 transformer=make_pipeline(
121 FileSampleLoader(
122 data_loader=bob.io.base.load,
123 dataset_original_directory=rc.get(
124 "bob.db.multipie.directory", ""
125 ),
126 extension=rc.get("bob.db.multipie.extension", ".png"),
127 ),
128 MultiposeAnnotations(),
129 ),
130 annotation_type=annotation_type,
131 fixed_positions=fixed_positions,
132 )