Datasets:
Tasks:
Image Classification
Sub-tasks:
multi-class-image-classification
Languages:
English
Size:
10K<n<100K
License:
Commit
·
d8aba72
1
Parent(s):
f49b253
Delete MapReader_Data_SIGSPATIAL_2022
Browse files- MapReader_Data_SIGSPATIAL_2022 +0 -110
MapReader_Data_SIGSPATIAL_2022
DELETED
|
@@ -1,110 +0,0 @@
|
|
| 1 |
-
# Copyright 2020 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 |
-
"""TODO"""
|
| 15 |
-
|
| 16 |
-
import csv
|
| 17 |
-
import os
|
| 18 |
-
|
| 19 |
-
import datasets
|
| 20 |
-
from PIL import Image
|
| 21 |
-
|
| 22 |
-
_CITATION = """\
|
| 23 |
-
@dataset{kasra_hosseini_2022_7147906,
|
| 24 |
-
author = {Kasra Hosseini and
|
| 25 |
-
Daniel C.S. Wilson and
|
| 26 |
-
Kaspar Beelen and
|
| 27 |
-
Katherine McDonough},
|
| 28 |
-
title = {MapReader_Data_SIGSPATIAL_2022},
|
| 29 |
-
month = oct,
|
| 30 |
-
year = 2022,
|
| 31 |
-
publisher = {Zenodo},
|
| 32 |
-
version = {v0.3.3},
|
| 33 |
-
doi = {10.5281/zenodo.7147906},
|
| 34 |
-
url = {https://doi.org/10.5281/zenodo.7147906}
|
| 35 |
-
}
|
| 36 |
-
"""
|
| 37 |
-
|
| 38 |
-
_DESCRIPTION = """\
|
| 39 |
-
TODO"""
|
| 40 |
-
|
| 41 |
-
_HOMEPAGE = "https://doi.org/10.5281/zenodo.3366686"
|
| 42 |
-
_LICENSE = "Creative Commons Attribution Non Commercial Share Alike 4.0 International"
|
| 43 |
-
|
| 44 |
-
_URL = "https://zenodo.org/record/7147906/files/MapReader_Data_SIGSPATIAL_2022.zip?download=1"
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
class RailspaceData(datasets.GeneratorBasedBuilder):
|
| 48 |
-
"""National Library of Scotland Railspace dataset."""
|
| 49 |
-
|
| 50 |
-
VERSION = datasets.Version("1.1.0")
|
| 51 |
-
|
| 52 |
-
def _info(self):
|
| 53 |
-
features = datasets.Features(
|
| 54 |
-
{
|
| 55 |
-
"image": datasets.Image(),
|
| 56 |
-
"label": datasets.ClassLabel(
|
| 57 |
-
names=[
|
| 58 |
-
"no building or railspace",
|
| 59 |
-
"railspace",
|
| 60 |
-
"building",
|
| 61 |
-
"railspace and non railspace building",
|
| 62 |
-
]
|
| 63 |
-
), # Labels: 0: no [building or railspace]; 1: railspace; 2: building; and 3: railspace and [non railspace] building.
|
| 64 |
-
"map_sheet": datasets.Value("string"),
|
| 65 |
-
}
|
| 66 |
-
)
|
| 67 |
-
|
| 68 |
-
return datasets.DatasetInfo(
|
| 69 |
-
description=_DESCRIPTION,
|
| 70 |
-
features=features,
|
| 71 |
-
homepage=_HOMEPAGE,
|
| 72 |
-
license=_LICENSE,
|
| 73 |
-
citation=_CITATION,
|
| 74 |
-
)
|
| 75 |
-
|
| 76 |
-
def _split_generators(self, dl_manager):
|
| 77 |
-
data = dl_manager.download_and_extract(_URL)
|
| 78 |
-
|
| 79 |
-
return [
|
| 80 |
-
datasets.SplitGenerator(
|
| 81 |
-
name=datasets.Split.TRAIN,
|
| 82 |
-
gen_kwargs={"data": data, "split": "train"},
|
| 83 |
-
),
|
| 84 |
-
datasets.SplitGenerator(
|
| 85 |
-
name=datasets.Split.VALIDATION,
|
| 86 |
-
gen_kwargs={"data": data, "split": "valid"},
|
| 87 |
-
),
|
| 88 |
-
datasets.SplitGenerator(
|
| 89 |
-
name=datasets.Split.TEST,
|
| 90 |
-
gen_kwargs={"data": data, "split": "test"},
|
| 91 |
-
),
|
| 92 |
-
]
|
| 93 |
-
|
| 94 |
-
def _generate_examples(self, data, split):
|
| 95 |
-
with open(
|
| 96 |
-
os.path.join(
|
| 97 |
-
data, f"MapReader_Data_SIGSPATIAL_2022/annotations/{split}.csv"
|
| 98 |
-
),
|
| 99 |
-
"r",
|
| 100 |
-
) as f:
|
| 101 |
-
reader = csv.DictReader(f)
|
| 102 |
-
for id_, row in enumerate(reader):
|
| 103 |
-
label = row["label"]
|
| 104 |
-
map_sheet = row["image_id"].split("#")[1]
|
| 105 |
-
image_file = os.path.join(
|
| 106 |
-
data,
|
| 107 |
-
f"MapReader_Data_SIGSPATIAL_2022/annotations/{row['image_id']}",
|
| 108 |
-
)
|
| 109 |
-
image = Image.open(image_file)
|
| 110 |
-
yield id_, {"image": image, "label": label, "map_sheet": map_sheet}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|