Datasets:
parquet-converter
commited on
Commit
•
411932c
1
Parent(s):
92e45a2
Update parquet files
Browse files- .gitattributes +0 -37
- README.md +0 -199
- dataset_infos.json +0 -1
- default/illustrated_ads-train.parquet +3 -0
- illustrated_ads.py +0 -136
.gitattributes
DELETED
@@ -1,37 +0,0 @@
|
|
1 |
-
*.7z filter=lfs diff=lfs merge=lfs -text
|
2 |
-
*.arrow filter=lfs diff=lfs merge=lfs -text
|
3 |
-
*.bin filter=lfs diff=lfs merge=lfs -text
|
4 |
-
*.bz2 filter=lfs diff=lfs merge=lfs -text
|
5 |
-
*.ftz filter=lfs diff=lfs merge=lfs -text
|
6 |
-
*.gz filter=lfs diff=lfs merge=lfs -text
|
7 |
-
*.h5 filter=lfs diff=lfs merge=lfs -text
|
8 |
-
*.joblib filter=lfs diff=lfs merge=lfs -text
|
9 |
-
*.lfs.* filter=lfs diff=lfs merge=lfs -text
|
10 |
-
*.model filter=lfs diff=lfs merge=lfs -text
|
11 |
-
*.msgpack filter=lfs diff=lfs merge=lfs -text
|
12 |
-
*.onnx filter=lfs diff=lfs merge=lfs -text
|
13 |
-
*.ot filter=lfs diff=lfs merge=lfs -text
|
14 |
-
*.parquet filter=lfs diff=lfs merge=lfs -text
|
15 |
-
*.pb filter=lfs diff=lfs merge=lfs -text
|
16 |
-
*.pt filter=lfs diff=lfs merge=lfs -text
|
17 |
-
*.pth filter=lfs diff=lfs merge=lfs -text
|
18 |
-
*.rar filter=lfs diff=lfs merge=lfs -text
|
19 |
-
saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
20 |
-
*.tar.* filter=lfs diff=lfs merge=lfs -text
|
21 |
-
*.tflite filter=lfs diff=lfs merge=lfs -text
|
22 |
-
*.tgz filter=lfs diff=lfs merge=lfs -text
|
23 |
-
*.wasm filter=lfs diff=lfs merge=lfs -text
|
24 |
-
*.xz filter=lfs diff=lfs merge=lfs -text
|
25 |
-
*.zip filter=lfs diff=lfs merge=lfs -text
|
26 |
-
*.zstandard filter=lfs diff=lfs merge=lfs -text
|
27 |
-
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
28 |
-
# Audio files - uncompressed
|
29 |
-
*.pcm filter=lfs diff=lfs merge=lfs -text
|
30 |
-
*.sam filter=lfs diff=lfs merge=lfs -text
|
31 |
-
*.raw filter=lfs diff=lfs merge=lfs -text
|
32 |
-
# Audio files - compressed
|
33 |
-
*.aac filter=lfs diff=lfs merge=lfs -text
|
34 |
-
*.flac filter=lfs diff=lfs merge=lfs -text
|
35 |
-
*.mp3 filter=lfs diff=lfs merge=lfs -text
|
36 |
-
*.ogg filter=lfs diff=lfs merge=lfs -text
|
37 |
-
*.wav filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
README.md
DELETED
@@ -1,199 +0,0 @@
|
|
1 |
-
---
|
2 |
-
annotations_creators:
|
3 |
-
- expert-generated
|
4 |
-
language: []
|
5 |
-
language_creators: []
|
6 |
-
license:
|
7 |
-
- cc0-1.0
|
8 |
-
multilinguality: []
|
9 |
-
pretty_name: 19th Century United States Newspaper Advert images with 'illustrated'
|
10 |
-
or 'non illustrated' labels
|
11 |
-
size_categories:
|
12 |
-
- n<1K
|
13 |
-
source_datasets: []
|
14 |
-
tags:
|
15 |
-
- lam
|
16 |
-
- historic newspapers
|
17 |
-
task_categories:
|
18 |
-
- image-classification
|
19 |
-
task_ids:
|
20 |
-
- multi-class-image-classification
|
21 |
-
---
|
22 |
-
|
23 |
-
|
24 |
-
The Dataset contains images derived from the [Newspaper Navigator](news-navigator.labs.loc.gov/), a dataset of images drawn from the Library of Congress Chronicling America collection (chroniclingamerica.loc.gov/).
|
25 |
-
|
26 |
-
> [The Newspaper Navigator dataset](https://news-navigator.labs.loc.gov/) consists of extracted visual content for 16,358,041 historic newspaper pages in Chronicling America. The visual content was identified using an object detection model trained on annotations of World War 1-era Chronicling America pages, including annotations made by volunteers as part of the Beyond Words crowdsourcing project. source: https://news-navigator.labs.loc.gov/
|
27 |
-
|
28 |
-
One of these categories is 'advertisements'. This dataset contains a sample of these images with additional labels indicating if the advert is 'illustrated' or 'not illustrated'.
|
29 |
-
|
30 |
-
This dataset was created for use in a [Programming Historian tutorial](http://programminghistorian.github.io/ph-submissions/lessons/computer-vision-deep-learning-pt1). The primary aim of the data was to provide a realistic example dataset for teaching computer vision for working with digitised heritage material.
|
31 |
-
|
32 |
-
|
33 |
-
# Dataset Card for 19th Century United States Newspaper Advert images with 'illustrated' or 'non illustrated' labels
|
34 |
-
|
35 |
-
## Table of Contents
|
36 |
-
- [Table of Contents](#table-of-contents)
|
37 |
-
- [Dataset Description](#dataset-description)
|
38 |
-
- [Dataset Summary](#dataset-summary)
|
39 |
-
- [Supported Tasks and Leaderboards](#supported-tasks-and-leaderboards)
|
40 |
-
- [Languages](#languages)
|
41 |
-
- [Dataset Structure](#dataset-structure)
|
42 |
-
- [Data Instances](#data-instances)
|
43 |
-
- [Data Fields](#data-fields)
|
44 |
-
- [Data Splits](#data-splits)
|
45 |
-
- [Dataset Creation](#dataset-creation)
|
46 |
-
- [Curation Rationale](#curation-rationale)
|
47 |
-
- [Source Data](#source-data)
|
48 |
-
- [Annotations](#annotations)
|
49 |
-
- [Personal and Sensitive Information](#personal-and-sensitive-information)
|
50 |
-
- [Considerations for Using the Data](#considerations-for-using-the-data)
|
51 |
-
- [Social Impact of Dataset](#social-impact-of-dataset)
|
52 |
-
- [Discussion of Biases](#discussion-of-biases)
|
53 |
-
- [Other Known Limitations](#other-known-limitations)
|
54 |
-
- [Additional Information](#additional-information)
|
55 |
-
- [Dataset Curators](#dataset-curators)
|
56 |
-
- [Licensing Information](#licensing-information)
|
57 |
-
- [Citation Information](#citation-information)
|
58 |
-
- [Contributions](#contributions)
|
59 |
-
|
60 |
-
## Dataset Description
|
61 |
-
|
62 |
-
- **Homepage:**
|
63 |
-
- **Repository:**[https://doi.org/10.5281/zenodo.5838410](https://doi.org/10.5281/zenodo.5838410)
|
64 |
-
- **Paper:**[https://doi.org/10.46430/phen0101](https://doi.org/10.46430/phen0101)
|
65 |
-
- **Leaderboard:**
|
66 |
-
- **Point of Contact:**
|
67 |
-
|
68 |
-
### Dataset Summary
|
69 |
-
|
70 |
-
The Dataset contains images derived from the [Newspaper Navigator](news-navigator.labs.loc.gov/), a dataset of images drawn from the Library of Congress Chronicling America collection (chroniclingamerica.loc.gov/).
|
71 |
-
|
72 |
-
> [The Newspaper Navigator dataset](https://news-navigator.labs.loc.gov/) consists of extracted visual content for 16,358,041 historic newspaper pages in Chronicling America. The visual content was identified using an object detection model trained on annotations of World War 1-era Chronicling America pages, including annotations made by volunteers as part of the Beyond Words crowdsourcing project. source: https://news-navigator.labs.loc.gov/
|
73 |
-
|
74 |
-
One of these categories is 'advertisements. This dataset contains a sample of these images with additional labels indicating if the advert is 'illustrated' or 'not illustrated'.
|
75 |
-
|
76 |
-
This dataset was created for use in a [Programming Historian tutorial](http://programminghistorian.github.io/ph-submissions/lessons/computer-vision-deep-learning-pt1). The primary aim of the data was to provide a realistic example dataset for teaching computer vision for working with digitised heritage material.
|
77 |
-
|
78 |
-
|
79 |
-
### Supported Tasks and Leaderboards
|
80 |
-
|
81 |
-
- `image-classification`: the primary purpose of this dataset is for classifying historic newspaper images identified as being 'advertisements' into 'illustrated' and 'not-illustrated' categories.
|
82 |
-
|
83 |
-
### Languages
|
84 |
-
|
85 |
-
[More Information Needed]
|
86 |
-
|
87 |
-
## Dataset Structure
|
88 |
-
|
89 |
-
### Data Instances
|
90 |
-
|
91 |
-
An example instance from this dataset
|
92 |
-
|
93 |
-
``` python
|
94 |
-
{'file': 'pst_fenske_ver02_data_sn84026497_00280776129_1880042101_0834_002_6_96.jpg',
|
95 |
-
'image': <PIL.JpegImagePlugin.JpegImageFile image mode=L size=388x395 at 0x7F9A72038950>,
|
96 |
-
'label': 0,
|
97 |
-
'pub_date': Timestamp('1880-04-21 00:00:00'),
|
98 |
-
'page_seq_num': 834,
|
99 |
-
'edition_seq_num': 1,
|
100 |
-
'batch': 'pst_fenske_ver02',
|
101 |
-
'lccn': 'sn84026497',
|
102 |
-
'box': [0.649412214756012,
|
103 |
-
0.6045778393745422,
|
104 |
-
0.8002520799636841,
|
105 |
-
0.7152365446090698],
|
106 |
-
'score': 0.9609346985816956,
|
107 |
-
'ocr': "H. II. IIASLKT & SOXN, Dealers in General Merchandise In New Store Room nt HASLET'S COS ITERS, 'JTionoMtii, ln. .Tau'y 1st, 1?0.",
|
108 |
-
'place_of_publication': 'Tionesta, Pa.',
|
109 |
-
'geographic_coverage': "['Pennsylvania--Forest--Tionesta']",
|
110 |
-
'name': 'The Forest Republican. [volume]',
|
111 |
-
'publisher': 'Ed. W. Smiley',
|
112 |
-
'url': 'https://news-navigator.labs.loc.gov/data/pst_fenske_ver02/data/sn84026497/00280776129/1880042101/0834/002_6_96.jpg',
|
113 |
-
'page_url': 'https://chroniclingamerica.loc.gov/data/batches/pst_fenske_ver02/data/sn84026497/00280776129/1880042101/0834.jp2'}
|
114 |
-
```
|
115 |
-
### Data Fields
|
116 |
-
|
117 |
-
[More Information Needed]
|
118 |
-
|
119 |
-
### Data Splits
|
120 |
-
|
121 |
-
The dataset contains a single split.
|
122 |
-
|
123 |
-
## Dataset Creation
|
124 |
-
|
125 |
-
### Curation Rationale
|
126 |
-
|
127 |
-
[More Information Needed]
|
128 |
-
|
129 |
-
### Source Data
|
130 |
-
|
131 |
-
#### Initial Data Collection and Normalization
|
132 |
-
|
133 |
-
[More Information Needed]
|
134 |
-
|
135 |
-
#### Who are the source language producers?
|
136 |
-
|
137 |
-
[More Information Needed]
|
138 |
-
|
139 |
-
### Annotations
|
140 |
-
|
141 |
-
#### Annotation process
|
142 |
-
|
143 |
-
A description of the annotation process is outlined in this [GitHub repository](https://github.com/Living-with-machines/nnanno)
|
144 |
-
[More Information Needed]
|
145 |
-
|
146 |
-
#### Who are the annotators?
|
147 |
-
|
148 |
-
[More Information Needed]
|
149 |
-
|
150 |
-
### Personal and Sensitive Information
|
151 |
-
|
152 |
-
[More Information Needed]
|
153 |
-
|
154 |
-
## Considerations for Using the Data
|
155 |
-
|
156 |
-
### Social Impact of Dataset
|
157 |
-
|
158 |
-
[More Information Needed]
|
159 |
-
|
160 |
-
### Discussion of Biases
|
161 |
-
|
162 |
-
[More Information Needed]
|
163 |
-
|
164 |
-
### Other Known Limitations
|
165 |
-
|
166 |
-
[More Information Needed]
|
167 |
-
|
168 |
-
## Additional Information
|
169 |
-
|
170 |
-
### Dataset Curators
|
171 |
-
|
172 |
-
[More Information Needed]
|
173 |
-
|
174 |
-
### Licensing Information
|
175 |
-
|
176 |
-
[More Information Needed]
|
177 |
-
|
178 |
-
### Citation Information
|
179 |
-
|
180 |
-
``` bibtex
|
181 |
-
@dataset{van_strien_daniel_2021_5838410,
|
182 |
-
author = {van Strien, Daniel},
|
183 |
-
title = {{19th Century United States Newspaper Advert images
|
184 |
-
with 'illustrated' or 'non illustrated' labels}},
|
185 |
-
month = oct,
|
186 |
-
year = 2021,
|
187 |
-
publisher = {Zenodo},
|
188 |
-
version = {0.0.1},
|
189 |
-
doi = {10.5281/zenodo.5838410},
|
190 |
-
url = {https://doi.org/10.5281/zenodo.5838410}}
|
191 |
-
|
192 |
-
```
|
193 |
-
|
194 |
-
|
195 |
-
[More Information Needed]
|
196 |
-
|
197 |
-
### Contributions
|
198 |
-
|
199 |
-
Thanks to [@davanstrien](https://github.com/davanstrien) for adding this dataset.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
dataset_infos.json
DELETED
@@ -1 +0,0 @@
|
|
1 |
-
{"default": {"description": "The Dataset contains images derived from the Newspaper Navigator (news-navigator.labs.loc.gov/), a dataset of images drawn from the Library of Congress Chronicling America collection. \n", "citation": "@dataset{van_strien_daniel_2021_5838410,\n author = {van Strien, Daniel},\n title = {{19th Century United States Newspaper Advert images \n with 'illustrated' or 'non illustrated' labels}},\n month = oct,\n year = 2021,\n publisher = {Zenodo},\n version = {0.0.1},\n doi = {10.5281/zenodo.5838410},\n url = {https://doi.org/10.5281/zenodo.5838410}}\n", "homepage": "https://doi.org/10.5281/zenodo.5838410", "license": "Public Domain", "features": {"file": {"dtype": "string", "id": null, "_type": "Value"}, "image": {"decode": true, "id": null, "_type": "Image"}, "label": {"num_classes": 2, "names": ["text-only", "illustrations"], "id": null, "_type": "ClassLabel"}, "pub_date": {"dtype": "timestamp[ns]", "id": null, "_type": "Value"}, "page_seq_num": {"dtype": "int64", "id": null, "_type": "Value"}, "edition_seq_num": {"dtype": "int64", "id": null, "_type": "Value"}, "batch": {"dtype": "string", "id": null, "_type": "Value"}, "lccn": {"dtype": "string", "id": null, "_type": "Value"}, "box": {"feature": {"dtype": "float32", "id": null, "_type": "Value"}, "length": -1, "id": null, "_type": "Sequence"}, "score": {"dtype": "float64", "id": null, "_type": "Value"}, "ocr": {"dtype": "string", "id": null, "_type": "Value"}, "place_of_publication": {"dtype": "string", "id": null, "_type": "Value"}, "geographic_coverage": {"dtype": "string", "id": null, "_type": "Value"}, "name": {"dtype": "string", "id": null, "_type": "Value"}, "publisher": {"dtype": "string", "id": null, "_type": "Value"}, "url": {"dtype": "string", "id": null, "_type": "Value"}, "page_url": {"dtype": "string", "id": null, "_type": "Value"}}, "post_processed": null, "supervised_keys": null, "task_templates": null, "builder_name": "illustrated_ads", "config_name": "default", "version": {"version_str": "1.1.0", "description": null, "major": 1, "minor": 1, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 773969, "num_examples": 549, "dataset_name": "illustrated_ads"}}, "download_checksums": {"https://zenodo.org/record/5838410/files/images.zip?download=1": {"num_bytes": 48063000, "checksum": "05f1562bca55a44ff00ad52aec19b59ce10566d6d3d169ef75e0224e4a514295"}, "https://zenodo.org/record/5838410/files/ads.csv?download=1": {"num_bytes": 47362, "checksum": "001098f61be7630d985ffc61713c620a9a78518bda6f7ae569c43d37e032cccb"}, "https://zenodo.org/record/5838410/files/sample.csv?download=1": {"num_bytes": 876387, "checksum": "74f585434b9b644c30fbafe9ff400d52dbfb51d620551a23194ecf961db5d697"}}, "download_size": 48986749, "post_processing_size": null, "dataset_size": 773969, "size_in_bytes": 49760718}}
|
|
|
|
default/illustrated_ads-train.parquet
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:984d73fc2a29bb172f6516f886e127d78c9d524604d789901b17876ff544919a
|
3 |
+
size 48009351
|
illustrated_ads.py
DELETED
@@ -1,136 +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 |
-
"""Dataset of illustrated and non illustrated 19th Century newspaper ads."""
|
15 |
-
|
16 |
-
import ast
|
17 |
-
import os
|
18 |
-
import pandas as pd
|
19 |
-
import datasets
|
20 |
-
from PIL import Image
|
21 |
-
|
22 |
-
_CITATION = """\
|
23 |
-
@dataset{van_strien_daniel_2021_5838410,
|
24 |
-
author = {van Strien, Daniel},
|
25 |
-
title = {{19th Century United States Newspaper Advert images
|
26 |
-
with 'illustrated' or 'non illustrated' labels}},
|
27 |
-
month = oct,
|
28 |
-
year = 2021,
|
29 |
-
publisher = {Zenodo},
|
30 |
-
version = {0.0.1},
|
31 |
-
doi = {10.5281/zenodo.5838410},
|
32 |
-
url = {https://doi.org/10.5281/zenodo.5838410}}
|
33 |
-
"""
|
34 |
-
|
35 |
-
|
36 |
-
_DESCRIPTION = """\
|
37 |
-
The Dataset contains images derived from the Newspaper Navigator (news-navigator.labs.loc.gov/), a dataset of images drawn from the Library of Congress Chronicling America collection.
|
38 |
-
"""
|
39 |
-
|
40 |
-
_HOMEPAGE = "https://doi.org/10.5281/zenodo.5838410"
|
41 |
-
|
42 |
-
_LICENSE = "Public Domain"
|
43 |
-
|
44 |
-
|
45 |
-
_URLS = "https://zenodo.org/record/5838410/files/images.zip?download=1"
|
46 |
-
|
47 |
-
_DTYPES = {
|
48 |
-
"page_seq_num": "int64",
|
49 |
-
"edition_seq_num": "int64",
|
50 |
-
"batch": "string",
|
51 |
-
"lccn": "string",
|
52 |
-
"score": "float64",
|
53 |
-
"place_of_publication": "string",
|
54 |
-
"name": "string",
|
55 |
-
"publisher": "string",
|
56 |
-
"url": "string",
|
57 |
-
"page_url": "string",
|
58 |
-
}
|
59 |
-
|
60 |
-
|
61 |
-
class IllustratedAds(datasets.GeneratorBasedBuilder):
|
62 |
-
"""Illustated Historic Newspaper Ads datasets"""
|
63 |
-
|
64 |
-
VERSION = datasets.Version("1.1.0")
|
65 |
-
|
66 |
-
def _info(self):
|
67 |
-
|
68 |
-
features = datasets.Features(
|
69 |
-
{
|
70 |
-
"file": datasets.Value("string"),
|
71 |
-
"image": datasets.Image(),
|
72 |
-
"label": datasets.ClassLabel(names=["text-only", "illustrations"]),
|
73 |
-
"pub_date": datasets.Value("timestamp[ns]"),
|
74 |
-
"page_seq_num": datasets.Value("int64"),
|
75 |
-
"edition_seq_num": datasets.Value("int64"),
|
76 |
-
"batch": datasets.Value("string"),
|
77 |
-
"lccn": datasets.Value("string"),
|
78 |
-
"box": datasets.Sequence(datasets.Value("float32")),
|
79 |
-
"score": datasets.Value("float64"),
|
80 |
-
"ocr": datasets.Value("string"),
|
81 |
-
"place_of_publication": datasets.Value("string"),
|
82 |
-
"geographic_coverage": datasets.Value("string"),
|
83 |
-
"name": datasets.Value("string"),
|
84 |
-
"publisher": datasets.Value("string"),
|
85 |
-
"url": datasets.Value("string"),
|
86 |
-
"page_url": datasets.Value("string"),
|
87 |
-
}
|
88 |
-
)
|
89 |
-
|
90 |
-
return datasets.DatasetInfo(
|
91 |
-
description=_DESCRIPTION,
|
92 |
-
features=features,
|
93 |
-
homepage=_HOMEPAGE,
|
94 |
-
license=_LICENSE,
|
95 |
-
citation=_CITATION,
|
96 |
-
)
|
97 |
-
|
98 |
-
def _split_generators(self, dl_manager):
|
99 |
-
images = dl_manager.download_and_extract(_URLS)
|
100 |
-
annotations = dl_manager.download(
|
101 |
-
[
|
102 |
-
"https://zenodo.org/record/5838410/files/ads.csv?download=1",
|
103 |
-
"https://zenodo.org/record/5838410/files/sample.csv?download=1",
|
104 |
-
]
|
105 |
-
)
|
106 |
-
df_labels = pd.read_csv(annotations[0], index_col=0)
|
107 |
-
df_metadata = pd.read_csv(
|
108 |
-
annotations[1],
|
109 |
-
index_col=0,
|
110 |
-
dtype=_DTYPES,
|
111 |
-
)
|
112 |
-
df_metadata["file"] = df_metadata.filepath.str.replace("/", "_")
|
113 |
-
df_metadata = df_metadata.set_index("file", drop=True)
|
114 |
-
df = df_labels.join(df_metadata)
|
115 |
-
df = df.reset_index()
|
116 |
-
annotations = df.to_dict(orient="records")
|
117 |
-
return [
|
118 |
-
datasets.SplitGenerator(
|
119 |
-
name=datasets.Split.TRAIN,
|
120 |
-
gen_kwargs={
|
121 |
-
"images": images,
|
122 |
-
"annotations": annotations,
|
123 |
-
},
|
124 |
-
),
|
125 |
-
]
|
126 |
-
|
127 |
-
def _generate_examples(self, images, annotations):
|
128 |
-
for id_, row in enumerate(annotations):
|
129 |
-
box = ast.literal_eval(row["box"])
|
130 |
-
row["box"] = box
|
131 |
-
row.pop("filepath")
|
132 |
-
ocr = " ".join(ast.literal_eval(row["ocr"]))
|
133 |
-
row["ocr"] = ocr
|
134 |
-
image = row["file"]
|
135 |
-
row["image"] = os.path.join(images, image)
|
136 |
-
yield id_, row
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|