Datasets:
Yanpeng Yuan
commited on
Commit
·
d35d646
1
Parent(s):
9a9445b
update
Browse files
zhlds.py
CHANGED
|
@@ -25,6 +25,9 @@ from zipfile import ZipFile
|
|
| 25 |
from io import BytesIO
|
| 26 |
from PIL import Image
|
| 27 |
|
|
|
|
|
|
|
|
|
|
| 28 |
_ELEVATER_CITATION = """\
|
| 29 |
@article{li2022elevater,
|
| 30 |
title={ELEVATER: A Benchmark and Toolkit for Evaluating Language-Augmented Visual Models},
|
|
@@ -36,8 +39,12 @@ Note that each ELEVATER dataset has its own citation. Please see the source to
|
|
| 36 |
get the correct citation for each contained dataset.
|
| 37 |
"""
|
| 38 |
|
| 39 |
-
|
| 40 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 41 |
|
| 42 |
_CIFAR_10_CITATION="""\
|
| 43 |
@article{krizhevsky2009learning,
|
|
@@ -85,7 +92,7 @@ class ELEVATER(datasets.GeneratorBasedBuilder):
|
|
| 85 |
name="cifar-10",
|
| 86 |
description="The CIFAR-10 dataset consists of 60000 32x32 colour images in 10 classes, with 6000 images per class. There are 50000 training images and 10000 test images.",
|
| 87 |
contact="pinjin",
|
| 88 |
-
version=
|
| 89 |
type_="classification_multiclass",
|
| 90 |
root_folder="classification/cifar_10_20211007",
|
| 91 |
labelmap="labels.txt",
|
|
@@ -101,8 +108,35 @@ class ELEVATER(datasets.GeneratorBasedBuilder):
|
|
| 101 |
"num_images": 10000
|
| 102 |
},
|
| 103 |
citation=_CIFAR_10_CITATION,
|
| 104 |
-
url=
|
| 105 |
),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 106 |
]
|
| 107 |
|
| 108 |
def _info(self):
|
|
@@ -121,6 +155,8 @@ class ELEVATER(datasets.GeneratorBasedBuilder):
|
|
| 121 |
|
| 122 |
def _split_generators(self, dl_manager):
|
| 123 |
_URL = self.config.url + self.config.root_folder
|
|
|
|
|
|
|
| 124 |
urls_to_download = {
|
| 125 |
"labelmap": os.path.join(_URL, self.config.labelmap),
|
| 126 |
"train": {
|
|
|
|
| 25 |
from io import BytesIO
|
| 26 |
from PIL import Image
|
| 27 |
|
| 28 |
+
_VERSION = "1.0.0"
|
| 29 |
+
_BASE_URL = "https://cvinthewildeus.blob.core.windows.net/datasets/"
|
| 30 |
+
|
| 31 |
_ELEVATER_CITATION = """\
|
| 32 |
@article{li2022elevater,
|
| 33 |
title={ELEVATER: A Benchmark and Toolkit for Evaluating Language-Augmented Visual Models},
|
|
|
|
| 39 |
get the correct citation for each contained dataset.
|
| 40 |
"""
|
| 41 |
|
| 42 |
+
_VOC_2007_CLASSIFICATION_CITATION="""\
|
| 43 |
+
@misc{pascal-voc-2007,
|
| 44 |
+
author = "Everingham, M. and Van~Gool, L. and Williams, C. K. I. and Winn, J. and Zisserman, A.",
|
| 45 |
+
title = "The {PASCAL} {V}isual {O}bject {C}lasses {C}hallenge 2007 {(VOC2007)} {R}esults",
|
| 46 |
+
howpublished = "http://www.pascal-network.org/challenges/VOC/voc2007/workshop/index.html"
|
| 47 |
+
}"""
|
| 48 |
|
| 49 |
_CIFAR_10_CITATION="""\
|
| 50 |
@article{krizhevsky2009learning,
|
|
|
|
| 92 |
name="cifar-10",
|
| 93 |
description="The CIFAR-10 dataset consists of 60000 32x32 colour images in 10 classes, with 6000 images per class. There are 50000 training images and 10000 test images.",
|
| 94 |
contact="pinjin",
|
| 95 |
+
version=_VERSION,
|
| 96 |
type_="classification_multiclass",
|
| 97 |
root_folder="classification/cifar_10_20211007",
|
| 98 |
labelmap="labels.txt",
|
|
|
|
| 108 |
"num_images": 10000
|
| 109 |
},
|
| 110 |
citation=_CIFAR_10_CITATION,
|
| 111 |
+
url=_BASE_URL,
|
| 112 |
),
|
| 113 |
+
ELEVATERConfig(
|
| 114 |
+
"name"="voc-2007-classification",
|
| 115 |
+
"description"="Voc2007 classification dataset.",
|
| 116 |
+
"contact"="pinjin",
|
| 117 |
+
"version"=_VERSION,
|
| 118 |
+
"type"="classification_multilabel",
|
| 119 |
+
"root_folder"="classification/voc2007_20211007",
|
| 120 |
+
"train": {
|
| 121 |
+
"index_path": "train_ic.txt",
|
| 122 |
+
"files_for_local_usage": ["train.zip"],
|
| 123 |
+
"num_images": 2501
|
| 124 |
+
},
|
| 125 |
+
"val": {
|
| 126 |
+
"index_path": "val_ic.txt",
|
| 127 |
+
"files_for_local_usage": ["train.zip"],
|
| 128 |
+
"num_images": 2510
|
| 129 |
+
},
|
| 130 |
+
"test": {
|
| 131 |
+
"index_path": "test_ic.txt",
|
| 132 |
+
"files_for_local_usage": ["test.zip"],
|
| 133 |
+
"num_images": 4952
|
| 134 |
+
},
|
| 135 |
+
"labelmap": "labels.txt",
|
| 136 |
+
"num_classes": 20,
|
| 137 |
+
citation=_VOC_2007_CLASSIFICATION_CITATION,
|
| 138 |
+
url=_BASE_URL,
|
| 139 |
+
)
|
| 140 |
]
|
| 141 |
|
| 142 |
def _info(self):
|
|
|
|
| 155 |
|
| 156 |
def _split_generators(self, dl_manager):
|
| 157 |
_URL = self.config.url + self.config.root_folder
|
| 158 |
+
print(self.config.val)
|
| 159 |
+
print(good)
|
| 160 |
urls_to_download = {
|
| 161 |
"labelmap": os.path.join(_URL, self.config.labelmap),
|
| 162 |
"train": {
|