testman data
Browse filesThis view is limited to 50 files because it contains too many changes.
See raw diff
- .DS_Store +0 -0
- __pycache__/config.cpython-310.pyc +0 -0
- __pycache__/config.cpython-311.pyc +0 -0
- config.py +2 -0
- create-tar-file.py +10 -0
- image-text-demo.py +70 -0
- images.tar.gz +3 -0
- images/1.png +3 -0
- images/10.png +3 -0
- images/11.png +3 -0
- images/12.png +3 -0
- images/13.png +3 -0
- images/14.png +3 -0
- images/15.png +3 -0
- images/16.png +3 -0
- images/17.png +3 -0
- images/18.png +3 -0
- images/19.png +3 -0
- images/2.png +3 -0
- images/20.png +3 -0
- images/21.png +3 -0
- images/22.png +3 -0
- images/23.png +3 -0
- images/24.png +3 -0
- images/25.png +3 -0
- images/3.png +3 -0
- images/4.png +3 -0
- images/5.png +3 -0
- images/6.png +3 -0
- images/7.png +3 -0
- images/8.png +3 -0
- images/9.png +3 -0
- requirements.txt +1 -0
- texts.tar.gz +3 -0
- texts/1.txt +1 -0
- texts/10.txt +1 -0
- texts/11.txt +1 -0
- texts/12.txt +1 -0
- texts/13.txt +1 -0
- texts/14.txt +1 -0
- texts/15.txt +1 -0
- texts/16.txt +1 -0
- texts/17.txt +1 -0
- texts/18.txt +1 -0
- texts/19.txt +1 -0
- texts/2.txt +1 -0
- texts/20.txt +1 -0
- texts/21.txt +1 -0
- texts/22.txt +1 -0
- texts/23.txt +1 -0
.DS_Store
ADDED
Binary file (6.15 kB). View file
|
|
__pycache__/config.cpython-310.pyc
ADDED
Binary file (255 Bytes). View file
|
|
__pycache__/config.cpython-311.pyc
ADDED
Binary file (273 Bytes). View file
|
|
config.py
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
1 |
+
TAR_FILE_IMAGES='./images.tar.gz'
|
2 |
+
TAR_FILE_TEXTS='./texts.tar.gz'
|
create-tar-file.py
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import tarfile
|
2 |
+
from config import TAR_FILE_IMAGES, TAR_FILE_TEXTS
|
3 |
+
|
4 |
+
|
5 |
+
if __name__ == "__main__":
|
6 |
+
with tarfile.open( TAR_FILE_IMAGES, 'w:xz') as tar:
|
7 |
+
tar.add('./images')
|
8 |
+
|
9 |
+
with tarfile.open( TAR_FILE_TEXTS, 'w:xz') as tar:
|
10 |
+
tar.add('./texts')
|
image-text-demo.py
ADDED
@@ -0,0 +1,70 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import datasets
|
2 |
+
|
3 |
+
from config import TAR_FILE_IMAGES, TAR_FILE_TEXTS
|
4 |
+
|
5 |
+
_CITATION = """\
|
6 |
+
@InProceedings{huggingface:dataset,
|
7 |
+
title = {Small image-text set},
|
8 |
+
author={James Briggs},
|
9 |
+
year={2022}
|
10 |
+
}
|
11 |
+
"""
|
12 |
+
|
13 |
+
_DESCRIPTION = """\
|
14 |
+
Demo dataset for testing or showing image-text capabilities.
|
15 |
+
"""
|
16 |
+
_HOMEPAGE = "https://huggingface.co/datasets/jamescalam/image-text-demo"
|
17 |
+
|
18 |
+
_LICENSE = ""
|
19 |
+
|
20 |
+
_REPO = "https://huggingface.co/datasets/jamescalam/image-text-demo"
|
21 |
+
|
22 |
+
class ImageSet(datasets.GeneratorBasedBuilder):
|
23 |
+
"""Small sample of image-text pairs"""
|
24 |
+
|
25 |
+
def _info(self):
|
26 |
+
return datasets.DatasetInfo(
|
27 |
+
description=_DESCRIPTION,
|
28 |
+
features=datasets.Features(
|
29 |
+
{
|
30 |
+
'text': datasets.Value("string"),
|
31 |
+
'image': datasets.Image(),
|
32 |
+
}
|
33 |
+
),
|
34 |
+
supervised_keys=None,
|
35 |
+
homepage=_HOMEPAGE,
|
36 |
+
citation=_CITATION,
|
37 |
+
)
|
38 |
+
|
39 |
+
def _split_generators(self, dl_manager):
|
40 |
+
images_archive = dl_manager.download(f"{_REPO}/resolve/main/{TAR_FILE_IMAGES}")
|
41 |
+
image_iters = dl_manager.iter_archive(images_archive)
|
42 |
+
|
43 |
+
|
44 |
+
texts_archive = dl_manager.download(f"{_REPO}/resolve/main/{TAR_FILE_TEXTS}")
|
45 |
+
text_iters = dl_manager.iter_archive(texts_archive)
|
46 |
+
|
47 |
+
return [
|
48 |
+
datasets.SplitGenerator(
|
49 |
+
name=datasets.Split.TRAIN,
|
50 |
+
gen_kwargs={
|
51 |
+
"images": image_iters,
|
52 |
+
"texts": text_iters,
|
53 |
+
}
|
54 |
+
),
|
55 |
+
]
|
56 |
+
|
57 |
+
def _generate_examples(self, images, texts):
|
58 |
+
""" This function returns the examples in the raw (text) form."""
|
59 |
+
|
60 |
+
for idx, (filepath, image) in enumerate(images):
|
61 |
+
|
62 |
+
# get the corresponding text fime and read it
|
63 |
+
description = next(texts)[1].read().decode('utf-8')
|
64 |
+
|
65 |
+
yield idx, {
|
66 |
+
"image": {"path": filepath, "bytes": image.read()},
|
67 |
+
"text": description,
|
68 |
+
}
|
69 |
+
|
70 |
+
|
images.tar.gz
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:bc56b5d6c394ea1ff463ff9211f4af0cd4c441b8192f91eabbd9224e1120c1e5
|
3 |
+
size 7660992
|
images/1.png
ADDED
![]() |
Git LFS Details
|
images/10.png
ADDED
![]() |
Git LFS Details
|
images/11.png
ADDED
![]() |
Git LFS Details
|
images/12.png
ADDED
![]() |
Git LFS Details
|
images/13.png
ADDED
![]() |
Git LFS Details
|
images/14.png
ADDED
![]() |
Git LFS Details
|
images/15.png
ADDED
![]() |
Git LFS Details
|
images/16.png
ADDED
![]() |
Git LFS Details
|
images/17.png
ADDED
![]() |
Git LFS Details
|
images/18.png
ADDED
![]() |
Git LFS Details
|
images/19.png
ADDED
![]() |
Git LFS Details
|
images/2.png
ADDED
![]() |
Git LFS Details
|
images/20.png
ADDED
![]() |
Git LFS Details
|
images/21.png
ADDED
![]() |
Git LFS Details
|
images/22.png
ADDED
![]() |
Git LFS Details
|
images/23.png
ADDED
![]() |
Git LFS Details
|
images/24.png
ADDED
![]() |
Git LFS Details
|
images/25.png
ADDED
![]() |
Git LFS Details
|
images/3.png
ADDED
![]() |
Git LFS Details
|
images/4.png
ADDED
![]() |
Git LFS Details
|
images/5.png
ADDED
![]() |
Git LFS Details
|
images/6.png
ADDED
![]() |
Git LFS Details
|
images/7.png
ADDED
![]() |
Git LFS Details
|
images/8.png
ADDED
![]() |
Git LFS Details
|
images/9.png
ADDED
![]() |
Git LFS Details
|
requirements.txt
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
datasets
|
texts.tar.gz
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:de1d8f1146d5e095af2c87cb037df992252887c82e8727f95a5102f7e58545b6
|
3 |
+
size 1120
|
texts/1.txt
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
Testman, side view, from side, plain background, gray background
|
texts/10.txt
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
Testman, karate chop pose, karate, from side, plain background, gray background
|
texts/11.txt
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
Testman, thinking, sit pose, crossed legs, plain background, gray background
|
texts/12.txt
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
Testman, combat pose, holding katana, front view, plain background, gray background
|
texts/13.txt
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
Testman, mantis pose, kung fu pose, combat pose, plain background, gray background
|
texts/14.txt
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
Testman, portrait, front view, face portrait, plain background, gray background
|
texts/15.txt
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
Testman, portrait, front view, face portrait, plain background, gray background
|
texts/16.txt
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
Testman, portrait, front view, face portrait, plain background, gray background
|
texts/17.txt
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
Testman, laydown, plain background, gray background
|
texts/18.txt
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
Testman, disapointed, plain background, gray background
|
texts/19.txt
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
Testman, portrait, front view, face portrait, plain background, gray background
|
texts/2.txt
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
Testman, standing, front view, plain background, gray background
|
texts/20.txt
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
Testman, combat pose, martial stance, plain background, gray background
|
texts/21.txt
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
Testman, sit down, looking up, plain background, gray background
|
texts/22.txt
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
Testman, winning pose, victory, happy, plain background, gray background
|
texts/23.txt
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
Testman, teasing, playful, plain background, gray background
|