@@ -97,28 +97,31 @@ def _generate_examples(self, image_paths, metadata_path):
97
97
for sample_path , sample_object in tfds .download .iter_archive (tar_file , tfds .download .ExtractMethod .TAR_STREAM ):
98
98
file_name = sample_path
99
99
100
+ if file_name not in metadata .index :
101
+ continue
102
+
100
103
sample_metadata = metadata .loc [file_name ]
101
104
102
105
yield file_name , {
103
106
'image' : sample_object ,
104
107
'filename' : file_name ,
105
108
'person' : sample_metadata ['person' ],
106
- 'depiction' : sample_metadata [ 'depiction' ] ,
107
- 'body_part' : sample_metadata [ 'body_part' ] ,
108
- 'predominantly_female' : sample_metadata [ 'predominantly_female' ] ,
109
- 'predominantly_male' : sample_metadata [ 'predominantly_male' ] ,
110
- 'gender_unknown' : sample_metadata [ 'gender_unknown' ] ,
111
- 'young' : sample_metadata [ 'young' ] ,
112
- 'middle_age' : sample_metadata [ 'middle_age' ] ,
113
- 'older' : sample_metadata [ 'older' ] ,
114
- 'age_unknown' : sample_metadata [ 'age_unknown' ] ,
115
- 'near' : sample_metadata [ 'near' ] ,
116
- 'medium_distance' : sample_metadata [ 'medium_distance' ] ,
117
- 'far' : sample_metadata [ 'far' ] ,
118
- 'dark' : sample_metadata [ 'dark' ] ,
119
- 'normal_lighting' : sample_metadata [ 'normal_lighting' ] ,
120
- 'bright' : sample_metadata [ 'bright' ] ,
121
- 'person_depiction' : sample_metadata [ 'person_depiction' ] ,
122
- 'non-person_depiction' : sample_metadata [ 'non-person_depiction' ] ,
123
- 'non-person_non-depiction' : sample_metadata [ 'non-person_non-depiction' ] ,
109
+ 'depiction' : sample_metadata . get ( 'depiction' , - 1 ) ,
110
+ 'body_part' : sample_metadata . get ( 'body_part' , - 1 ) ,
111
+ 'predominantly_female' : sample_metadata . get ( 'predominantly_female' , - 1 ) ,
112
+ 'predominantly_male' : sample_metadata . get ( 'predominantly_male' , - 1 ) ,
113
+ 'gender_unknown' : sample_metadata . get ( 'gender_unknown' , - 1 ) ,
114
+ 'young' : sample_metadata . get ( 'young' , - 1 ) ,
115
+ 'middle_age' : sample_metadata . get ( 'middle_age' , - 1 ) ,
116
+ 'older' : sample_metadata . get ( 'older' , - 1 ) ,
117
+ 'age_unknown' : sample_metadata . get ( 'age_unknown' , - 1 ) ,
118
+ 'near' : sample_metadata . get ( 'near' , - 1 ) ,
119
+ 'medium_distance' : sample_metadata . get ( 'medium_distance' , - 1 ) ,
120
+ 'far' : sample_metadata . get ( 'far' , - 1 ) ,
121
+ 'dark' : sample_metadata . get ( 'dark' , - 1 ) ,
122
+ 'normal_lighting' : sample_metadata . get ( 'normal_lighting' , - 1 ) ,
123
+ 'bright' : sample_metadata . get ( 'bright' , - 1 ) ,
124
+ 'person_depiction' : sample_metadata . get ( 'person_depiction' , - 1 ) ,
125
+ 'non-person_depiction' : sample_metadata . get ( 'non-person_depiction' , - 1 ) ,
126
+ 'non-person_non-depiction' : sample_metadata . get ( 'non-person_non-depiction' , - 1 ) ,
124
127
}
0 commit comments