Skip to content

Commit 2fcebb6

Browse files
committed
added dataset test cases
1 parent 39053dd commit 2fcebb6

11 files changed

+75
-18
lines changed

tensorflow_datasets/image_classification/wake_vision/dummy_data/TODO-add_fake_data_in_this_directory.txt

Whitespace-only changes.
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
filename,person,depiction,body_part,predominantly_female,predominantly_male,gender_unknown,young,middle_age,older,age_unknown,near,medium_distance,far,dark,normal_lighting,bright,person_depiction,non-person_depiction,non-person_non-depiction
2+
29127_790d1b99cc_o.jpg,0,0,1,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,1
3+
59607_671e1b2157_o.jpg,0,0,1,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,1
4+
109054_388f919ed4_o.jpg,1,0,1,0,1,0,0,0,1,0,1,0,0,0,1,0,0,0,0
5+
180057_d37268b631_o.jpg,0,0,1,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,1
6+
179941_438714d070_o.jpg,0,1,1,0,0,0,0,0,0,0,0,0,0,0,1,0,0,1,0
7+
38797_6edc6879a1_o.jpg,0,0,1,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,1
8+
260620_85699b8993_o.jpg,1,0,1,0,0,0,0,0,0,0,0,1,0,0,1,0,0,0,0
9+
145432_4c818df8e6_o.jpg,0,0,1,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,1
10+
91955_f917b5af3c_o.jpg,1,0,1,0,0,0,0,0,0,0,0,1,0,0,1,0,0,0,0
11+
141087_22f5abfbfd_o.jpg,1,0,1,0,1,0,0,1,0,0,1,0,0,1,0,0,0,0,0
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
filename,person,depiction,body_part
2+
100727_bed121ce34_o.jpg,0,0,1
3+
101840_4a841f0176_o.jpg,0,0,1
4+
106121_09196ba72e_o.jpg,1,0,1
5+
106115_4e80111436_o.jpg,1,0,1
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
filename,person
2+
102213_c3dd41b7ab_o.jpg,0
3+
102706_1b97e5aa38_o.jpg,1
4+
101647_969c80e66b_o.jpg,0
5+
101649_a854571b66_o.jpg,0
6+
102708_948ffafe58_o.jpg,0
7+
104012_c92940f019_o.jpg,0
8+
100727_bed121ce34_o.jpg,0
9+
101713_568f7e27dd_o.jpg,1
10+
101711_789ee1bddc_o.jpg,1
11+
101708_0f3ece0fb9_o.jpg,1
12+
101840_4a841f0176_o.jpg,0
13+
106121_09196ba72e_o.jpg,1
14+
107679_79ed728a4a_o.jpg,1
15+
104655_fccf213c45_o.jpg,0
16+
105348_fbd1abdf92_o.jpg,0
17+
106115_4e80111436_o.jpg,1
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
filename,person,depiction,body_part,predominantly_female,predominantly_male,gender_unknown,young,middle_age,older,age_unknown,near,medium_distance,far,dark,normal_lighting,bright,person_depiction,non-person_depiction,non-person_non-depiction
2+
433396_7e2adb7c1f_o.jpg,1,0,1,0,0,0,0,0,0,0,1,0,0,0,1,0,0,0,0
3+
84796_33170b4470_o.jpg,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,1
4+
147267_170719f2ba_o.jpg,1,0,1,0,0,1,0,0,0,1,1,0,0,0,1,0,0,0,0
5+
250671_38cb883ff0_o.jpg,0,0,1,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,1
6+
151908_ca198a6f5a_o.jpg,0,0,1,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,1
7+
446802_ebc54eb6f2_o.jpg,1,0,1,0,0,0,0,0,0,0,1,0,0,0,1,0,0,0,0
8+
301205_fcd8ab7e6a_o.jpg,0,0,1,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,1
9+
370561_e31c6f61fd_o.jpg,1,0,1,0,0,0,0,0,0,0,1,0,0,0,1,0,0,0,0
10+
431150_6a666d03d6_o.jpg,1,0,1,0,1,0,0,1,0,0,1,0,0,0,1,0,0,0,0
11+
61045_92df9b0c72_o.jpg,0,0,1,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,1
12+
415278_f656a1607f_o.jpg,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,-1,-1,-1,-1,-1,-1

tensorflow_datasets/image_classification/wake_vision/wake_vision_dataset_builder.py

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
"""wake_vision dataset."""
22

33
import tensorflow_datasets.public_api as tfds
4+
import os
45

56
_TRAIN_IMAGE_IDS = [9270406, 9270356, 9270408, 9270367, 9270349, 9270351, 9270390, 9270375, 9270387, 9270370, 9270396, 9270340, 9270411, 9270369, 9270357, 9270378, 9270386, 9270376, 9270341, 9270392, 9270334, 9270404, 9270330, 9270321, 9270364, 9270380, 9270343, 9270335, 9270412, 9270362, 9270339, 9270331, 9270399, 9270410, 9270393, 9270325, 9270346, 9270337, 9270391, 9270361, 9270363, 9270372, 9270326, 9270322, 9270329, 9270381, 9270338, 9270397, 9270405, 9270379, 9270352, 9270400, 9270384, 9270383, 9270388, 9270324, 9270407, 9270348, 9270347, 9270371, 9270358, 9270350, 9270323, 9270401, 9270368, 9270360, 9270328, 9270327, 9270382, 9270332, 9270394, 9270409, 9270345, 9270342, 9270353, 9270403, 9270398, 9270402, 9270395, 9270333, 9270373, 9270336, 9270385, 9270320, 9270366, 9270374, 9270377, 9270354, 9270344, 9270359]
67

@@ -12,14 +13,20 @@
1213
)
1314
for id in _TRAIN_IMAGE_IDS
1415
],
15-
'validation_images': tfds.download.Resource(
16-
url='https://dataverse.harvard.edu/api/access/datafile/9270355?format=original',
17-
extract_method=tfds.download.ExtractMethod.GZIP,
18-
),
19-
'test_images': tfds.download.Resource(
20-
url='https://dataverse.harvard.edu/api/access/datafile/9270389?format=original',
21-
extract_method=tfds.download.ExtractMethod.GZIP,
22-
),
16+
'validation_images': [
17+
tfds.download.Resource(
18+
url='https://dataverse.harvard.edu/api/access/datafile/9270355?format=original',
19+
extract_method=tfds.download.ExtractMethod.GZIP,
20+
)
21+
]
22+
,
23+
'test_images': [
24+
tfds.download.Resource(
25+
url='https://dataverse.harvard.edu/api/access/datafile/9270389?format=original',
26+
extract_method=tfds.download.ExtractMethod.GZIP,
27+
)
28+
]
29+
,
2330
'train_image_metadata': 'https://dataverse.harvard.edu/api/access/datafile/9844933?format=original',
2431
'train_bbox_metadata': 'https://dataverse.harvard.edu/api/access/datafile/9844934?format=original',
2532
'validation_metadata': 'https://dataverse.harvard.edu/api/access/datafile/9844936?format=original',
@@ -95,7 +102,7 @@ def _generate_examples(self, image_paths, metadata_path):
95102

96103
for tar_file in image_paths:
97104
for sample_path, sample_object in tfds.download.iter_archive(tar_file, tfds.download.ExtractMethod.TAR_STREAM):
98-
file_name = sample_path
105+
file_name = os.path.basename(sample_path)
99106

100107
if file_name not in metadata.index:
101108
continue

0 commit comments

Comments
 (0)