pranjali-pathre
commited on
Commit
•
6f461e4
1
Parent(s):
5107e86
video_00
Browse files- README.md +15 -0
- data/video_00.zip +3 -0
- img2pose.py +72 -0
README.md
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
dataset_info:
|
3 |
+
config_name: video_00
|
4 |
+
features:
|
5 |
+
- name: original_image
|
6 |
+
dtype: image
|
7 |
+
- name: edit_pose
|
8 |
+
dtype: string
|
9 |
+
splits:
|
10 |
+
- name: train
|
11 |
+
num_bytes: 956869
|
12 |
+
num_examples: 3267
|
13 |
+
download_size: 20890085
|
14 |
+
dataset_size: 956869
|
15 |
+
---
|
data/video_00.zip
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:5ca4fdf9b643411452194da2e5504b25e431c2eb852420af18486a7b00778a09
|
3 |
+
size 20890085
|
img2pose.py
ADDED
@@ -0,0 +1,72 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import os
|
2 |
+
from xml.etree import ElementTree as ET
|
3 |
+
import datasets
|
4 |
+
|
5 |
+
_DESCRIPTION = """\
|
6 |
+
The dataset img2pose data.
|
7 |
+
"""
|
8 |
+
_NAME = "img2pose"
|
9 |
+
|
10 |
+
_HOMEPAGE = f"https://huggingface.co/datasets/pranjalipathre/{_NAME}"
|
11 |
+
|
12 |
+
_LICENSE = ""
|
13 |
+
|
14 |
+
# _DATA = f"https://huggingface.co/datasets/pranjalipathre/{_NAME}/resolve/main/data/"
|
15 |
+
_DATA = f"/home/pranjali/Documents/Research/pybullet/img2img/{_NAME}/data/"
|
16 |
+
|
17 |
+
class img2poseDataset(datasets.GeneratorBasedBuilder):
|
18 |
+
BUILDER_CONFIGS = [
|
19 |
+
# sapien-doors sequentail dataset. - 5.6k
|
20 |
+
datasets.BuilderConfig(name="video_00", data_dir=f"{_DATA}video_00.zip"),
|
21 |
+
]
|
22 |
+
|
23 |
+
DEFAULT_CONFIG_NAME = "video_00"
|
24 |
+
|
25 |
+
def _info(self):
|
26 |
+
return datasets.DatasetInfo(
|
27 |
+
description=_DESCRIPTION,
|
28 |
+
features=datasets.Features(
|
29 |
+
{
|
30 |
+
"original_image": datasets.Image(),
|
31 |
+
"edit_pose": datasets.Value("string"),
|
32 |
+
}
|
33 |
+
),
|
34 |
+
supervised_keys=None,
|
35 |
+
homepage=_HOMEPAGE,
|
36 |
+
citation=None,
|
37 |
+
)
|
38 |
+
|
39 |
+
def _split_generators(self, dl_manager):
|
40 |
+
data = dl_manager.download_and_extract(self.config.data_dir)
|
41 |
+
return [
|
42 |
+
datasets.SplitGenerator(
|
43 |
+
name=datasets.Split.TRAIN,
|
44 |
+
gen_kwargs={
|
45 |
+
"data": data,
|
46 |
+
},
|
47 |
+
),
|
48 |
+
]
|
49 |
+
|
50 |
+
@staticmethod
|
51 |
+
def parse_text(root: ET.Element, file: str, index: int) -> dict:
|
52 |
+
idx = str(index).zfill(6)
|
53 |
+
ele = root.find(f".//*[@frame='{idx}']")
|
54 |
+
dt = {
|
55 |
+
"text": ele.get("text")
|
56 |
+
}
|
57 |
+
return dt
|
58 |
+
|
59 |
+
def _generate_examples(self, data):
|
60 |
+
treePath = os.path.join(data, "annotations.xml")
|
61 |
+
|
62 |
+
tree = ET.parse(treePath)
|
63 |
+
root = tree.getroot()
|
64 |
+
|
65 |
+
for idx, file in enumerate(sorted(os.listdir(os.path.join(data, "original_images")))):
|
66 |
+
dat = self.parse_text(root, file, idx)
|
67 |
+
txt = dat["text"]
|
68 |
+
|
69 |
+
yield idx, {
|
70 |
+
"original_image": os.path.join(data, "original_images", file),
|
71 |
+
"edit_pose": txt,
|
72 |
+
}
|