Datasets:
lihao57
commited on
Commit
·
9d9dea1
0
Parent(s):
initial commit
Browse filesThis view is limited to 50 files because it contains too many changes.
See raw diff
- .gitattributes +62 -0
- .gitignore +2 -0
- .pre-commit-config.yaml +13 -0
- README.md +32 -0
- dataset.py +90 -0
- test/images/00031546.png +3 -0
- test/images/00031591.png +3 -0
- test/images/00031608.png +3 -0
- test/images/00031697.png +3 -0
- test/images/00031723.png +3 -0
- test/images/00031797.png +3 -0
- test/images/00031810.png +3 -0
- test/images/00031811.png +3 -0
- test/images/00031841.png +3 -0
- test/images/00031975.png +3 -0
- test/images/00032053.png +3 -0
- test/images/00033036.png +3 -0
- test/images/00033307.png +3 -0
- test/images/00033365.png +3 -0
- test/images/00033445.png +3 -0
- test/images/00033539.png +3 -0
- test/images/00033873.png +3 -0
- test/images/00034439.png +3 -0
- test/images/00035148.png +3 -0
- test/images/00035223.png +3 -0
- test/images/00035228.png +3 -0
- test/images/00035326.png +3 -0
- test/images/00035343.png +3 -0
- test/images/00035585.png +3 -0
- test/images/00035608.png +3 -0
- test/images/00035610.png +3 -0
- test/images/00035796.png +3 -0
- test/images/00036227.png +3 -0
- test/images/00036228.png +3 -0
- test/images/00036242.png +3 -0
- test/images/00036277.png +3 -0
- test/images/00036384.png +3 -0
- test/images/00036517.png +3 -0
- test/images/00036609.png +3 -0
- test/images/00036796.png +3 -0
- test/images/00036808.png +3 -0
- test/images/00036868.png +3 -0
- test/images/00036977.png +3 -0
- test/images/00037040.png +3 -0
- test/images/00037045.png +3 -0
- test/images/00037060.png +3 -0
- test/images/00037075.png +3 -0
- test/images/00037184.png +3 -0
- test/images/00037187.png +3 -0
- test/images/00037205.png +3 -0
.gitattributes
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 |
+
*.bz2 filter=lfs diff=lfs merge=lfs -text
|
| 5 |
+
*.ckpt 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 |
+
*.lz4 filter=lfs diff=lfs merge=lfs -text
|
| 12 |
+
*.mds filter=lfs diff=lfs merge=lfs -text
|
| 13 |
+
*.mlmodel filter=lfs diff=lfs merge=lfs -text
|
| 14 |
+
*.model filter=lfs diff=lfs merge=lfs -text
|
| 15 |
+
*.msgpack filter=lfs diff=lfs merge=lfs -text
|
| 16 |
+
*.npy filter=lfs diff=lfs merge=lfs -text
|
| 17 |
+
*.npz filter=lfs diff=lfs merge=lfs -text
|
| 18 |
+
*.onnx filter=lfs diff=lfs merge=lfs -text
|
| 19 |
+
*.ot filter=lfs diff=lfs merge=lfs -text
|
| 20 |
+
*.parquet filter=lfs diff=lfs merge=lfs -text
|
| 21 |
+
*.pb filter=lfs diff=lfs merge=lfs -text
|
| 22 |
+
*.pickle filter=lfs diff=lfs merge=lfs -text
|
| 23 |
+
*.pkl filter=lfs diff=lfs merge=lfs -text
|
| 24 |
+
*.pt filter=lfs diff=lfs merge=lfs -text
|
| 25 |
+
*.pth filter=lfs diff=lfs merge=lfs -text
|
| 26 |
+
*.rar filter=lfs diff=lfs merge=lfs -text
|
| 27 |
+
*.safetensors filter=lfs diff=lfs merge=lfs -text
|
| 28 |
+
saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
| 29 |
+
*.tar.* filter=lfs diff=lfs merge=lfs -text
|
| 30 |
+
*.tar filter=lfs diff=lfs merge=lfs -text
|
| 31 |
+
*.tflite filter=lfs diff=lfs merge=lfs -text
|
| 32 |
+
*.tgz filter=lfs diff=lfs merge=lfs -text
|
| 33 |
+
*.wasm filter=lfs diff=lfs merge=lfs -text
|
| 34 |
+
*.xz filter=lfs diff=lfs merge=lfs -text
|
| 35 |
+
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 36 |
+
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 37 |
+
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
| 38 |
+
# Audio files - uncompressed
|
| 39 |
+
*.pcm filter=lfs diff=lfs merge=lfs -text
|
| 40 |
+
*.sam filter=lfs diff=lfs merge=lfs -text
|
| 41 |
+
*.raw filter=lfs diff=lfs merge=lfs -text
|
| 42 |
+
# Audio files - compressed
|
| 43 |
+
*.aac filter=lfs diff=lfs merge=lfs -text
|
| 44 |
+
*.flac filter=lfs diff=lfs merge=lfs -text
|
| 45 |
+
*.mp3 filter=lfs diff=lfs merge=lfs -text
|
| 46 |
+
*.ogg filter=lfs diff=lfs merge=lfs -text
|
| 47 |
+
*.wav filter=lfs diff=lfs merge=lfs -text
|
| 48 |
+
# Image files - uncompressed
|
| 49 |
+
*.bmp filter=lfs diff=lfs merge=lfs -text
|
| 50 |
+
*.gif filter=lfs diff=lfs merge=lfs -text
|
| 51 |
+
*.png filter=lfs diff=lfs merge=lfs -text
|
| 52 |
+
*.tiff filter=lfs diff=lfs merge=lfs -text
|
| 53 |
+
# Image files - compressed
|
| 54 |
+
*.jpg filter=lfs diff=lfs merge=lfs -text
|
| 55 |
+
*.jpeg filter=lfs diff=lfs merge=lfs -text
|
| 56 |
+
*.webp filter=lfs diff=lfs merge=lfs -text
|
| 57 |
+
# Video files - compressed
|
| 58 |
+
*.mp4 filter=lfs diff=lfs merge=lfs -text
|
| 59 |
+
*.webm filter=lfs diff=lfs merge=lfs -text
|
| 60 |
+
*png filter=lfs diff=lfs merge=lfs -text
|
| 61 |
+
*pkl filter=lfs diff=lfs merge=lfs -text
|
| 62 |
+
*.jsonl filter=lfs diff=lfs merge=lfs -text
|
.gitignore
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
|
|
|
| 1 |
+
.vscode
|
| 2 |
+
.gradio
|
.pre-commit-config.yaml
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
repos:
|
| 2 |
+
- repo: https://github.com/psf/black
|
| 3 |
+
rev: 22.3.0
|
| 4 |
+
hooks:
|
| 5 |
+
- id: black
|
| 6 |
+
args: [--line-length=120]
|
| 7 |
+
- repo: https://github.com/pre-commit/pre-commit-hooks
|
| 8 |
+
rev: v3.2.0
|
| 9 |
+
hooks:
|
| 10 |
+
- id: check-json
|
| 11 |
+
- id: end-of-file-fixer
|
| 12 |
+
- id: trailing-whitespace
|
| 13 |
+
- id: requirements-txt-fixer
|
README.md
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
datasets: lh9171338/Wireframe
|
| 3 |
+
pretty_name: Wireframe Dataset
|
| 4 |
+
license: mit
|
| 5 |
+
tags:
|
| 6 |
+
- computer-vision
|
| 7 |
+
- line-segment-detection
|
| 8 |
+
- wireframe-parsing
|
| 9 |
+
size_categories: 1K<n<10K
|
| 10 |
+
---
|
| 11 |
+
|
| 12 |
+
# Wireframe Dataset
|
| 13 |
+
|
| 14 |
+
This is the **Wireframe dataset** hosted on Hugging Face Hub.
|
| 15 |
+
|
| 16 |
+
## Dataset Summary
|
| 17 |
+
|
| 18 |
+
Wireframe dataset with image annotations including line segments.
|
| 19 |
+
The dataset is stored as pickle files (`train.pkl`, `test.pkl`) and images.
|
| 20 |
+
A custom `dataset.py` is provided for loading.
|
| 21 |
+
|
| 22 |
+
## Usage
|
| 23 |
+
|
| 24 |
+
```python
|
| 25 |
+
from datasets import load_dataset
|
| 26 |
+
|
| 27 |
+
# Load the dataset from Hugging Face Hub
|
| 28 |
+
ds = load_dataset("lh9171338/Wireframe")
|
| 29 |
+
|
| 30 |
+
# Access samples
|
| 31 |
+
print(ds)
|
| 32 |
+
print(ds["train"][0])
|
dataset.py
ADDED
|
@@ -0,0 +1,90 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# -*- encoding: utf-8 -*-
|
| 2 |
+
|
| 3 |
+
"""
|
| 4 |
+
@File : dataset.py
|
| 5 |
+
@Time : 2025/08/31 23:00:00
|
| 6 |
+
@Author : lh9171338
|
| 7 |
+
@Version : 1.0
|
| 8 |
+
@Contact : 2909171338@qq.com
|
| 9 |
+
"""
|
| 10 |
+
|
| 11 |
+
import os
|
| 12 |
+
import tqdm
|
| 13 |
+
import pickle
|
| 14 |
+
import jsonlines
|
| 15 |
+
from datasets import Dataset, Features, Sequence, Value
|
| 16 |
+
|
| 17 |
+
|
| 18 |
+
def convert_pkl_to_parquet(split):
|
| 19 |
+
"""
|
| 20 |
+
Convert pkl file to parquet file
|
| 21 |
+
|
| 22 |
+
Args:
|
| 23 |
+
split (str): split name
|
| 24 |
+
|
| 25 |
+
Returns:
|
| 26 |
+
None
|
| 27 |
+
"""
|
| 28 |
+
# 加载 pkl 文件
|
| 29 |
+
with open(f"{split}/{split}.pkl", "rb") as f:
|
| 30 |
+
annotations = pickle.load(f)
|
| 31 |
+
|
| 32 |
+
# 新增 file_name 字段
|
| 33 |
+
new_annotations = []
|
| 34 |
+
for ann in tqdm.tqdm(annotations):
|
| 35 |
+
new_ann = dict(
|
| 36 |
+
file_name=ann["image_file"],
|
| 37 |
+
image_file=os.path.basename(ann["image_file"]),
|
| 38 |
+
image_size=ann["image_size"],
|
| 39 |
+
lines=ann["lines"].tolist(),
|
| 40 |
+
)
|
| 41 |
+
new_annotations.append(new_ann)
|
| 42 |
+
|
| 43 |
+
# 转 Dataset
|
| 44 |
+
features = Features(
|
| 45 |
+
{
|
| 46 |
+
"file_name": Value("string"),
|
| 47 |
+
"image_file": Value("string"),
|
| 48 |
+
"image_size": Sequence(Value("int32")),
|
| 49 |
+
"lines": Sequence(Sequence(Sequence(Value("float")))),
|
| 50 |
+
}
|
| 51 |
+
)
|
| 52 |
+
ds = Dataset.from_list(new_annotations, features=features)
|
| 53 |
+
|
| 54 |
+
# 保存 parquet
|
| 55 |
+
ds.to_parquet(f"{split}/metadata.parquet")
|
| 56 |
+
|
| 57 |
+
|
| 58 |
+
def convert_pkl_to_jsonl(split):
|
| 59 |
+
"""
|
| 60 |
+
Convert pkl file to jsonl file
|
| 61 |
+
|
| 62 |
+
Args:
|
| 63 |
+
split (str): split name
|
| 64 |
+
|
| 65 |
+
Returns:
|
| 66 |
+
None
|
| 67 |
+
"""
|
| 68 |
+
# 加载 pkl 文件
|
| 69 |
+
with open(f"{split}/{split}.pkl", "rb") as f:
|
| 70 |
+
annotations = pickle.load(f)
|
| 71 |
+
|
| 72 |
+
# 新增 file_name 字段
|
| 73 |
+
new_annotations = []
|
| 74 |
+
for ann in tqdm.tqdm(annotations):
|
| 75 |
+
new_ann = dict(
|
| 76 |
+
file_name=ann["image_file"],
|
| 77 |
+
image_file=os.path.basename(ann["image_file"]),
|
| 78 |
+
image_size=ann["image_size"],
|
| 79 |
+
lines=ann["lines"].tolist(),
|
| 80 |
+
)
|
| 81 |
+
new_annotations.append(new_ann)
|
| 82 |
+
|
| 83 |
+
# 保存 jsonl文件
|
| 84 |
+
with jsonlines.open(f"{split}/metadata.jsonl", "w") as f:
|
| 85 |
+
f.write_all(new_annotations)
|
| 86 |
+
|
| 87 |
+
|
| 88 |
+
if __name__ == "__main__":
|
| 89 |
+
convert_pkl_to_jsonl("train")
|
| 90 |
+
convert_pkl_to_jsonl("test")
|
test/images/00031546.png
ADDED
|
Git LFS Details
|
test/images/00031591.png
ADDED
|
Git LFS Details
|
test/images/00031608.png
ADDED
|
Git LFS Details
|
test/images/00031697.png
ADDED
|
Git LFS Details
|
test/images/00031723.png
ADDED
|
Git LFS Details
|
test/images/00031797.png
ADDED
|
Git LFS Details
|
test/images/00031810.png
ADDED
|
Git LFS Details
|
test/images/00031811.png
ADDED
|
Git LFS Details
|
test/images/00031841.png
ADDED
|
Git LFS Details
|
test/images/00031975.png
ADDED
|
Git LFS Details
|
test/images/00032053.png
ADDED
|
Git LFS Details
|
test/images/00033036.png
ADDED
|
Git LFS Details
|
test/images/00033307.png
ADDED
|
Git LFS Details
|
test/images/00033365.png
ADDED
|
Git LFS Details
|
test/images/00033445.png
ADDED
|
Git LFS Details
|
test/images/00033539.png
ADDED
|
Git LFS Details
|
test/images/00033873.png
ADDED
|
Git LFS Details
|
test/images/00034439.png
ADDED
|
Git LFS Details
|
test/images/00035148.png
ADDED
|
Git LFS Details
|
test/images/00035223.png
ADDED
|
Git LFS Details
|
test/images/00035228.png
ADDED
|
Git LFS Details
|
test/images/00035326.png
ADDED
|
Git LFS Details
|
test/images/00035343.png
ADDED
|
Git LFS Details
|
test/images/00035585.png
ADDED
|
Git LFS Details
|
test/images/00035608.png
ADDED
|
Git LFS Details
|
test/images/00035610.png
ADDED
|
Git LFS Details
|
test/images/00035796.png
ADDED
|
Git LFS Details
|
test/images/00036227.png
ADDED
|
Git LFS Details
|
test/images/00036228.png
ADDED
|
Git LFS Details
|
test/images/00036242.png
ADDED
|
Git LFS Details
|
test/images/00036277.png
ADDED
|
Git LFS Details
|
test/images/00036384.png
ADDED
|
Git LFS Details
|
test/images/00036517.png
ADDED
|
Git LFS Details
|
test/images/00036609.png
ADDED
|
Git LFS Details
|
test/images/00036796.png
ADDED
|
Git LFS Details
|
test/images/00036808.png
ADDED
|
Git LFS Details
|
test/images/00036868.png
ADDED
|
Git LFS Details
|
test/images/00036977.png
ADDED
|
Git LFS Details
|
test/images/00037040.png
ADDED
|
Git LFS Details
|
test/images/00037045.png
ADDED
|
Git LFS Details
|
test/images/00037060.png
ADDED
|
Git LFS Details
|
test/images/00037075.png
ADDED
|
Git LFS Details
|
test/images/00037184.png
ADDED
|
Git LFS Details
|
test/images/00037187.png
ADDED
|
Git LFS Details
|
test/images/00037205.png
ADDED
|
Git LFS Details
|