· 6 years ago · Dec 02, 2019, 11:26 PM
1"""Fine-Grained Visual Classification of Aircraft (FGVC-Aircraft) is a benchmark dataset for the fine grained visual categorization of aircraft."""
2
3from __future__ import absolute_import
4from __future__ import division
5from __future__ import print_function
6
7import tensorflow_datasets.public_api as tfds
8
9_CITATION = """@techreport{maji13fine-grained,
10 title = {Fine-Grained Visual Classification of Aircraft},
11 author = {S. Maji and J. Kannala and E. Rahtu and M. Blaschko and A. Vedaldi},
12 year = {2013},
13 archivePrefix = {arXiv},
14 eprint = {1306.5151},
15 primaryClass = "cs-cv",
16}
17"""
18
19_DESCRIPTION = """
20Fine-Grained Visual Classification of Aircraft (FGVC-Aircraft) is a benchmark dataset for the fine grained visual categorization of aircraft.
21"""
22
23_URL = "http://www.robots.ox.ac.uk/~vgg/data/fgvc-aircraft/archives/fgvc-aircraft-2013b.tar.gz"
24
25class Fgvc-aircraft(tfds.core.GeneratorBasedBuilder):
26
27 VERSION = tfds.core.Version('1.0.0')
28 SUPPORTED_VERSIONS = [
29 tfds.core.Version(
30 "3.0.0", "New split API (https://tensorflow.org/datasets/splits)"),
31 ]
32
33 def _info(self):
34 return tfds.core.DatasetInfo(
35 builder=self,
36 description=_DESCRIPTION,
37 #Are these valid arguments for features?
38 features=tfds.features.FeaturesDict({
39 "image": tfds.features.Image(),
40 "variant": tfds.features.ClassLabel(num_classes=102),
41 "family": tfds.features.ClassLabel(num_classes=70),
42 "manufacturer": tfds.features.ClassLabel(num_classes=41),
43 "bbox": tfds.features.BBoxFeature(),
44 }),
45 #Slightly confused what "supervised keys" are, would the following be correct?
46 supervised_keys=("image", "variant", "family", "manufacturer"),
47 homepage="http://www.robots.ox.ac.uk/~vgg/data/fgvc-aircraft/",
48 citation=_CITATION,
49 )
50
51 def _split_generators(self, dl_manager):
52 path = dl_manager.download_and_extract(_URL)
53
54 #how do I split the data? The names of the train/test pictures are in image_train.txt and image_test.txt files.
55 #this is unlike the example document where they have the images in train/test folders.
56 #how would I add image, variant, family, manufacturer, and bbox in this? The information is provided in different txt files for each property.
57
58 return [
59 tfds.core.SplitGenerator(
60 name=tfds.Split.TRAIN,
61 gen_kwargs={},
62 ),
63 tfds.core.SplitGenerator(
64 name=tfds.Split.TEST,
65 gen_kwargs={},
66 ),
67 ]
68
69 def _generate_examples(self):
70 """Yields examples."""
71
72 #because the properties are in different txt documents, would I have to process all of them first and then yield info?
73 #how would I structure what to yield?
74
75 yield 'key', {}