Laureηt commited on
Commit
9c8e127
·
unverified ·
1 Parent(s): 29227b0

feat: yay first dataset

Browse files
Files changed (2) hide show
  1. README.md +185 -1
  2. individuality_of_handwriting.py +65 -0
README.md CHANGED
@@ -1,3 +1,187 @@
1
  ---
2
- license: unknown
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3
  ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
+ annotations_creators:
3
+ - crowdsourced
4
+ language_creators:
5
+ - crowdsourced
6
+ language:
7
+ - en
8
+ license:
9
+ - unknown
10
+ multilinguality:
11
+ - monolingual
12
+ pretty_name: Individuality Of Handwriting
13
+ size_categories:
14
+ - 1K<n<10K
15
+ task_categories:
16
+ - image-classification
17
+ dataset_info:
18
+ features:
19
+ - name: image
20
+ dtype: image
21
+ - name: label
22
+ dtype:
23
+ class_label:
24
+ names:
25
+ 0: original
26
+ 1: forgeries
27
+ - name: individual
28
+ dtype: uint8
29
+ - name: figure
30
+ dtype: uint8
31
+ splits:
32
+ - name: train
33
+ num_examples: 1322
34
+ - name: validation
35
+ num_examples: 0
36
  ---
37
+
38
+ # Dataset Card for Individuality Of Handwriting
39
+
40
+ ## Table of Contents
41
+ - [Dataset Card for Individuality Of Handwriting](#dataset-card-for-individuality-of-handwriting)
42
+ - [Table of Contents](#table-of-contents)
43
+ - [Dataset Description](#dataset-description)
44
+ - [Dataset Summary](#dataset-summary)
45
+ - [Supported Tasks and Leaderboards](#supported-tasks-and-leaderboards)
46
+ - [Languages](#languages)
47
+ - [Dataset Structure](#dataset-structure)
48
+ - [Data Instances](#data-instances)
49
+ - [Data Fields](#data-fields)
50
+ - [Data Splits](#data-splits)
51
+ - [Dataset Creation](#dataset-creation)
52
+ - [Curation Rationale](#curation-rationale)
53
+ - [Source Data](#source-data)
54
+ - [Initial Data Collection and Normalization](#initial-data-collection-and-normalization)
55
+ - [Who are the source language producers?](#who-are-the-source-language-producers)
56
+ - [Annotations](#annotations)
57
+ - [Annotation process](#annotation-process)
58
+ - [Who are the annotators?](#who-are-the-annotators)
59
+ - [Personal and Sensitive Information](#personal-and-sensitive-information)
60
+ - [Considerations for Using the Data](#considerations-for-using-the-data)
61
+ - [Social Impact of Dataset](#social-impact-of-dataset)
62
+ - [Discussion of Biases](#discussion-of-biases)
63
+ - [Other Known Limitations](#other-known-limitations)
64
+ - [Additional Information](#additional-information)
65
+ - [Dataset Curators](#dataset-curators)
66
+ - [Licensing Information](#licensing-information)
67
+ - [Citation Information](#citation-information)
68
+ - [Contributions](#contributions)
69
+
70
+ ## Dataset Description
71
+
72
+ ### Dataset Summary
73
+
74
+ [More Information Needed]
75
+
76
+ ### Supported Tasks and Leaderboards
77
+
78
+ [More Information Needed]
79
+
80
+ ### Languages
81
+
82
+ English
83
+
84
+ ## Dataset Structure
85
+
86
+ ### Data Instances
87
+
88
+ A sample from the training set is provided below:
89
+
90
+ ```
91
+ {
92
+ 'image': <PIL.JpegImagePlugin.JpegImageFile image mode=RGB size=384x512 at 0x276021C5EB8>,
93
+ 'label': 0,
94
+ 'individual': 10,
95
+ 'figure': 2
96
+ }
97
+ ```
98
+
99
+ ### Data Fields
100
+
101
+ The data instances have the following fields:
102
+
103
+ - `image`: A `PIL.Image.Image` object containing the image. Note that when accessing the image column: `dataset[0]["image"]` the image file is automatically decoded. Decoding of a large number of image files might take a significant amount of time. Thus it is important to first query the sample index before the `"image"` column, *i.e.* `dataset[0]["image"]` should **always** be preferred over `dataset["image"][0]`.
104
+ - `label`: an `int` classification label.
105
+
106
+ <details>
107
+ <summary>Class Label Mappings</summary>
108
+
109
+ ```json
110
+ {
111
+ "original": 0,
112
+ "forgeries": 1,
113
+ }
114
+ ```
115
+ </details>
116
+
117
+
118
+ ### Data Splits
119
+
120
+
121
+ | | train | validation |
122
+ | ------------- | ----: | ---------: |
123
+ | # of examples | 1322 | 0 |
124
+ | percentage | 100% | 0% |
125
+
126
+
127
+ ## Dataset Creation
128
+
129
+ ### Curation Rationale
130
+
131
+ [More Information Needed]
132
+
133
+ ### Source Data
134
+
135
+ #### Initial Data Collection and Normalization
136
+
137
+ [More Information Needed]
138
+
139
+ #### Who are the source language producers?
140
+
141
+ [More Information Needed]
142
+
143
+ ### Annotations
144
+
145
+ #### Annotation process
146
+
147
+ [More Information Needed]
148
+
149
+ #### Who are the annotators?
150
+
151
+ [More Information Needed]
152
+
153
+ ### Personal and Sensitive Information
154
+
155
+ [More Information Needed]
156
+
157
+ ## Considerations for Using the Data
158
+
159
+ ### Social Impact of Dataset
160
+
161
+ [More Information Needed]
162
+
163
+ ### Discussion of Biases
164
+
165
+ [More Information Needed]
166
+
167
+ ### Other Known Limitations
168
+
169
+ [More Information Needed]
170
+
171
+ ## Additional Information
172
+
173
+ ### Dataset Curators
174
+
175
+ [More Information Needed]
176
+
177
+ ### Licensing Information
178
+
179
+ [More Information Needed]
180
+
181
+ ### Citation Information
182
+
183
+ [More Information Needed]
184
+
185
+ ### Contributions
186
+
187
+ [More Information Needed]
individuality_of_handwriting.py ADDED
@@ -0,0 +1,65 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Dataset class for Individuality Of Handwriting dataset."""
2
+
3
+ import pathlib
4
+
5
+ from datasets.tasks import ImageClassification
6
+
7
+ import datasets
8
+
9
+ _BASE_URL = "https://cedar.buffalo.edu/NIJ/data/signatures.rar"
10
+
11
+ _HOMEPAGE = "https://cedar.buffalo.edu/NIJ/projectinfo.html"
12
+
13
+ _DESCRIPTION = """
14
+ This dataset consists of handwriting samples of 1500 individuals, representative of the US population with respect to gender, age, ethnic groups...
15
+ """
16
+
17
+ _NAMES = [
18
+ "original",
19
+ "forgeries",
20
+ ]
21
+
22
+ class IndividualityOfHandwriting(datasets.GeneratorBasedBuilder):
23
+ """Food-101 Images dataset."""
24
+
25
+ def _info(self):
26
+ return datasets.DatasetInfo(
27
+ description=_DESCRIPTION,
28
+ features=datasets.Features(
29
+ {
30
+ "image": datasets.Image(),
31
+ "label": datasets.ClassLabel(names=_NAMES),
32
+ "individual": datasets.Value("uint8"),
33
+ "figure": datasets.Value("uint8"),
34
+ }
35
+ ),
36
+ supervised_keys=("image", "label"),
37
+ homepage=_HOMEPAGE,
38
+ task_templates=[ImageClassification(image_column="image", label_column="label")],
39
+ )
40
+
41
+ def _split_generators(self, dl_manager):
42
+ archive_path = dl_manager.download_and_extract(_BASE_URL)
43
+
44
+ return [
45
+ datasets.SplitGenerator(
46
+ name=datasets.Split.TRAIN,
47
+ gen_kwargs={
48
+ "data_dir": archive_path,
49
+ },
50
+ ),
51
+ ]
52
+
53
+ def _generate_examples(self, data_dir):
54
+ """Generate images and labels for splits."""
55
+ rglob = pathlib.Path(data_dir).rglob("*.png")
56
+ for index, filepath in enumerate(rglob):
57
+ filename = filepath.with_suffix("").name
58
+ label, individual, figure = filename.split("_")
59
+
60
+ yield index, {
61
+ "image": str(filepath),
62
+ "label": label,
63
+ "individual": individual,
64
+ "figure": figure,
65
+ }