Datasets:
Commit
·
6af36b6
1
Parent(s):
549f3f3
Delete loading script
Browse files- brill_iconclass.py +0 -75
brill_iconclass.py
DELETED
@@ -1,75 +0,0 @@
|
|
1 |
-
# Copyright 2022 The HuggingFace Datasets Authors and the current dataset script contributor.
|
2 |
-
#
|
3 |
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
4 |
-
# you may not use this file except in compliance with the License.
|
5 |
-
# You may obtain a copy of the License at
|
6 |
-
#
|
7 |
-
# http://www.apache.org/licenses/LICENSE-2.0
|
8 |
-
#
|
9 |
-
# Unless required by applicable law or agreed to in writing, software
|
10 |
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
11 |
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12 |
-
# See the License for the specific language governing permissions and
|
13 |
-
# limitations under the License.
|
14 |
-
"""Brill Iconclass AI Test Set data."""
|
15 |
-
|
16 |
-
import json
|
17 |
-
import os
|
18 |
-
from PIL import Image
|
19 |
-
import datasets
|
20 |
-
|
21 |
-
_CITATION = """\
|
22 |
-
@MISC{iconclass,
|
23 |
-
title = {Brill Iconclass AI Test Set},
|
24 |
-
author={Etienne Posthumus},
|
25 |
-
year={2020}
|
26 |
-
}
|
27 |
-
"""
|
28 |
-
|
29 |
-
|
30 |
-
_DESCRIPTION = """\
|
31 |
-
A dataset for applying machine learning to collections described with the Iconclass classification system.
|
32 |
-
"""
|
33 |
-
|
34 |
-
_HOMEPAGE = "https://iconclass.org/testset/"
|
35 |
-
|
36 |
-
_LICENSE = "https://creativecommons.org/publicdomain/zero/1.0/"
|
37 |
-
|
38 |
-
_URL = "https://iconclass.org/testset/779ba2ca9e977c58d818e3823a676973.zip"
|
39 |
-
|
40 |
-
class BrillIconclass(datasets.GeneratorBasedBuilder):
|
41 |
-
"""Brill IconClass AI dataset"""
|
42 |
-
|
43 |
-
VERSION = datasets.Version("1.1.0")
|
44 |
-
|
45 |
-
|
46 |
-
def _info(self):
|
47 |
-
features = datasets.Features(
|
48 |
-
{
|
49 |
-
"image": datasets.Image(),
|
50 |
-
"label": [datasets.Value("string")]
|
51 |
-
}
|
52 |
-
)
|
53 |
-
return datasets.DatasetInfo(
|
54 |
-
description=_DESCRIPTION,
|
55 |
-
features=features,
|
56 |
-
homepage=_HOMEPAGE,
|
57 |
-
license=_LICENSE,
|
58 |
-
citation=_CITATION,
|
59 |
-
)
|
60 |
-
|
61 |
-
def _split_generators(self, dl_manager):
|
62 |
-
data_dir = dl_manager.download_and_extract(_URL)
|
63 |
-
return [
|
64 |
-
datasets.SplitGenerator(
|
65 |
-
name=datasets.Split.TRAIN,
|
66 |
-
gen_kwargs={"data_json": os.path.join(data_dir, "data.json"), "data_dir": data_dir},
|
67 |
-
),
|
68 |
-
]
|
69 |
-
|
70 |
-
def _generate_examples(self, data_json, data_dir):
|
71 |
-
with open(data_json, encoding="utf-8") as f:
|
72 |
-
data = json.load(f)
|
73 |
-
for row, item in enumerate(data.items()):
|
74 |
-
filepath, labels = item
|
75 |
-
yield row, {"image": os.path.join(data_dir, filepath), "label": labels}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|