Commit
·
8e7ac0f
0
Parent(s):
init
Browse files- .gitattributes +27 -0
- README.md +5 -0
- cat-rotated.jpg +0 -0
- fixtures_image_utils.py +78 -0
.gitattributes
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 |
+
*.bin.* filter=lfs diff=lfs merge=lfs -text
|
| 5 |
+
*.bz2 filter=lfs diff=lfs merge=lfs -text
|
| 6 |
+
*.ftz filter=lfs diff=lfs merge=lfs -text
|
| 7 |
+
*.gz filter=lfs diff=lfs merge=lfs -text
|
| 8 |
+
*.h5 filter=lfs diff=lfs merge=lfs -text
|
| 9 |
+
*.joblib filter=lfs diff=lfs merge=lfs -text
|
| 10 |
+
*.lfs.* filter=lfs diff=lfs merge=lfs -text
|
| 11 |
+
*.model filter=lfs diff=lfs merge=lfs -text
|
| 12 |
+
*.msgpack filter=lfs diff=lfs merge=lfs -text
|
| 13 |
+
*.onnx filter=lfs diff=lfs merge=lfs -text
|
| 14 |
+
*.ot filter=lfs diff=lfs merge=lfs -text
|
| 15 |
+
*.parquet filter=lfs diff=lfs merge=lfs -text
|
| 16 |
+
*.pb filter=lfs diff=lfs merge=lfs -text
|
| 17 |
+
*.pt filter=lfs diff=lfs merge=lfs -text
|
| 18 |
+
*.pth filter=lfs diff=lfs merge=lfs -text
|
| 19 |
+
*.rar filter=lfs diff=lfs merge=lfs -text
|
| 20 |
+
saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
| 21 |
+
*.tar.* filter=lfs diff=lfs merge=lfs -text
|
| 22 |
+
*.tflite filter=lfs diff=lfs merge=lfs -text
|
| 23 |
+
*.tgz 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
|
README.md
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
This dataset includes 2 images: one of the [IAM Handwriting Database](https://fki.tic.heia-fr.ch/databases/iam-handwriting-database) and one of the [SRIOE](https://rrc.cvc.uab.es/?ch=13) dataset.
|
| 2 |
+
|
| 3 |
+
They are used for testing OCR models that are part of the HuggingFace Transformers library.
|
| 4 |
+
|
| 5 |
+
More specifically, they are used inside `test_modeling_vision_encoder_decoder_model.py`, for testing the TrOCR models.
|
cat-rotated.jpg
ADDED
|
fixtures_image_utils.py
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# coding=utf-8
|
| 2 |
+
# Copyright 2021 The TensorFlow Datasets Authors and the HuggingFace Datasets Authors.
|
| 3 |
+
#
|
| 4 |
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
| 5 |
+
# you may not use this file except in compliance with the License.
|
| 6 |
+
# You may obtain a copy of the License at
|
| 7 |
+
#
|
| 8 |
+
# http://www.apache.org/licenses/LICENSE-2.0
|
| 9 |
+
#
|
| 10 |
+
# Unless required by applicable law or agreed to in writing, software
|
| 11 |
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
| 12 |
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 13 |
+
# See the License for the specific language governing permissions and
|
| 14 |
+
# limitations under the License.
|
| 15 |
+
import textwrap
|
| 16 |
+
import datasets
|
| 17 |
+
_CITATION = """\\n"""
|
| 18 |
+
_DESCRIPTION = """\\n"""
|
| 19 |
+
class FixturesOCRConfig(datasets.BuilderConfig):
|
| 20 |
+
"""BuilderConfig for fixtures OCR"""
|
| 21 |
+
def __init__(
|
| 22 |
+
self,
|
| 23 |
+
data_url,
|
| 24 |
+
url,
|
| 25 |
+
task_templates=None,
|
| 26 |
+
**kwargs,
|
| 27 |
+
):
|
| 28 |
+
super(FixturesOCRConfig, self).__init__(
|
| 29 |
+
version=datasets.Version("1.9.0", ""), **kwargs
|
| 30 |
+
)
|
| 31 |
+
self.data_url = data_url
|
| 32 |
+
self.url = url
|
| 33 |
+
self.task_templates = task_templates
|
| 34 |
+
class FixturesOCR(datasets.GeneratorBasedBuilder):
|
| 35 |
+
"""Fixtures for OCR models. Includes 2 images."""
|
| 36 |
+
BUILDER_CONFIGS = [
|
| 37 |
+
FixturesOCRConfig(
|
| 38 |
+
name="image",
|
| 39 |
+
description=textwrap.dedent(""),
|
| 40 |
+
url="",
|
| 41 |
+
data_url="",
|
| 42 |
+
)
|
| 43 |
+
]
|
| 44 |
+
DEFAULT_CONFIG_NAME = "image"
|
| 45 |
+
def _info(self):
|
| 46 |
+
return datasets.DatasetInfo(
|
| 47 |
+
description=_DESCRIPTION,
|
| 48 |
+
features=datasets.Features(
|
| 49 |
+
{
|
| 50 |
+
"id": datasets.Value("string"),
|
| 51 |
+
"file": datasets.Value("string"),
|
| 52 |
+
}
|
| 53 |
+
),
|
| 54 |
+
supervised_keys=("file",),
|
| 55 |
+
homepage=self.config.url,
|
| 56 |
+
citation=_CITATION,
|
| 57 |
+
)
|
| 58 |
+
def _split_generators(self, dl_manager):
|
| 59 |
+
DL_URLS = [
|
| 60 |
+
f"https://huggingface.co/datasets/mishig/fixtures_image_utils/raw/main/{name}"
|
| 61 |
+
for name in ["cat-rotated.jpg"]
|
| 62 |
+
]
|
| 63 |
+
archive_path = dl_manager.download_and_extract(DL_URLS)
|
| 64 |
+
return [
|
| 65 |
+
datasets.SplitGenerator(
|
| 66 |
+
name=datasets.Split.TEST,
|
| 67 |
+
gen_kwargs={"archive_path": archive_path},
|
| 68 |
+
),
|
| 69 |
+
]
|
| 70 |
+
def _generate_examples(self, archive_path):
|
| 71 |
+
"""Generate examples."""
|
| 72 |
+
for i, filename in enumerate(archive_path):
|
| 73 |
+
key = str(i)
|
| 74 |
+
example = {
|
| 75 |
+
"id": key,
|
| 76 |
+
"file": filename,
|
| 77 |
+
}
|
| 78 |
+
yield key, example
|