nastyboget
commited on
Commit
•
581e2f6
1
Parent(s):
0f8c078
data added
Browse files- .gitattributes +1 -0
- gan_cyrillic.py +50 -0
- gt.txt +3 -0
- img.zip +3 -0
.gitattributes
CHANGED
@@ -52,3 +52,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
52 |
*.jpg filter=lfs diff=lfs merge=lfs -text
|
53 |
*.jpeg filter=lfs diff=lfs merge=lfs -text
|
54 |
*.webp filter=lfs diff=lfs merge=lfs -text
|
|
|
|
52 |
*.jpg filter=lfs diff=lfs merge=lfs -text
|
53 |
*.jpeg filter=lfs diff=lfs merge=lfs -text
|
54 |
*.webp filter=lfs diff=lfs merge=lfs -text
|
55 |
+
*.txt filter=lfs diff=lfs merge=lfs -text
|
gan_cyrillic.py
ADDED
@@ -0,0 +1,50 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import os
|
2 |
+
import pandas as pd
|
3 |
+
import zipfile
|
4 |
+
|
5 |
+
import datasets
|
6 |
+
from datasets import load_dataset
|
7 |
+
|
8 |
+
|
9 |
+
class GanCyrillic(datasets.GeneratorBasedBuilder):
|
10 |
+
|
11 |
+
def _info(self):
|
12 |
+
return datasets.DatasetInfo(
|
13 |
+
features=datasets.Features(
|
14 |
+
{
|
15 |
+
"image": datasets.Image(),
|
16 |
+
"path": datasets.Value("string"),
|
17 |
+
"name": datasets.Value("string"),
|
18 |
+
"text": datasets.Value("string")
|
19 |
+
}
|
20 |
+
)
|
21 |
+
)
|
22 |
+
|
23 |
+
def _split_generators(self, dl_manager):
|
24 |
+
_URLS = {"img": "img.zip", "labels": "gt.txt"}
|
25 |
+
data_paths = dl_manager.download_and_extract(_URLS)
|
26 |
+
|
27 |
+
return [datasets.SplitGenerator(
|
28 |
+
name=datasets.Split.TRAIN,
|
29 |
+
gen_kwargs={
|
30 |
+
"image_paths": dl_manager.iter_files(data_paths["img"]),
|
31 |
+
"labels_path": data_paths["labels"]
|
32 |
+
})]
|
33 |
+
|
34 |
+
def _generate_examples(self, image_paths, labels_path):
|
35 |
+
df = pd.read_csv(labels_path, sep=",", names=["path", "text"])
|
36 |
+
df["path"] = df.path.str[4:]
|
37 |
+
df.set_index("path", inplace=True)
|
38 |
+
|
39 |
+
for image_path in image_paths:
|
40 |
+
image_name = os.path.basename(image_path)
|
41 |
+
|
42 |
+
if image_name in df.index:
|
43 |
+
|
44 |
+
example = {
|
45 |
+
"image": image_path,
|
46 |
+
"path": image_path,
|
47 |
+
"name": image_name,
|
48 |
+
"text": df["text"][image_name]
|
49 |
+
}
|
50 |
+
yield image_name, example
|
gt.txt
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:7fdb67cbfcad3015de7e29d3e0357f451b6c98a4cbb9daf691826f65cf9a6ffe
|
3 |
+
size 15050196
|
img.zip
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:0080093573ec9cb3b3141e3d655af20fa15db62e34a1b1e46e5eb78a1ced3553
|
3 |
+
size 6717317040
|