Skip to main content

clean-dataset

데이터셋 정리 및 시각화 라이브러리

train/val/test로 구성된 비디오/이미지 데이터셋을 정리하고 시각화하는 도구입니다.

설치

pip install clean-dataset

사용법

from clean_dataset import image, split, mask_semantic, mask_instance, mask_panoptic, make_json, visualize

1. 이미지/마스크 폴더 구조 평탄화

# JPEGImages/video_id/frame.jpg -> images/video_id@frame.jpg
image("dataset")

# video_id/image/frame.jpg -> images/video_id@frame.jpg
image("dataset", source="image")

# video_id/mask/frame.png -> masks/video_id@frame.png
image("dataset", source="mask")

# 특정 split만 처리
image("dataset", splits=["train", "val", "test"])

2. 데이터셋 분할 (txt 파일 기반)

split("data", train="train.txt", val="val.txt", test="test.txt")
# 결과: train/, val/, test/ 폴더 생성

3. 마스크 생성

# 어노테이션 JSON에서 생성
mask_semantic("dataset", {
    "train": "train.json",
    "val": "val.json",
    "test": "test.json",  # test는 있으면 넣고 없으면 생략
})
mask_instance("dataset", {"train": "train.json", "val": "val.json"})
mask_panoptic("dataset", {"train": "train.json", "val": "val.json"})
# 결과: dataset/train/mask_semantic/, dataset/train/mask_instance/, ...

# RGB 마스크 폴더에서 생성
# 구조 1: split/panomasksRGB/video_id/*.png
mask_instance("dataset", {
    "train": "panomasksRGB",
    "val": "panomasksRGB",
}, from_rgb=True)

# 구조 2: split/data/video_id/mask/*.png
mask_instance("dataset", {
    "train": "data",
    "val": "data",
}, from_rgb=True, mask_folder="mask")

4. JSON 생성

# 어노테이션 JSON에서 bbox JSON 생성
make_json("dataset", {
    "train": ["train/instances.json"],
    "val": ["val/instances.json"],
    "test": ["test/instances.json"],
})
# 결과: dataset/train/json/, dataset/val/json/

# 마스크에서 직접 bbox 계산
make_json("dataset", {
    "train": "mask_instance",
    "val": "mask_instance",
}, from_mask=True)

# 카테고리 JSON 생성 (어노테이션에서 추출)
make_json("dataset", {
    "train": ["train.json"],
}, category=True, output_name="VIPSeg.json")

출력 JSON 형식 (bbox):

[
    {"id": 1, "tag": "person", "xmin": 701, "ymin": 0, "xmax": 1280, "ymax": 709},
    {"id": 2, "tag": "car", "xmin": 100, "ymin": 200, "xmax": 500, "ymax": 600}
]

출력 JSON 형식 (category, isthing 있을 때):

{
    "names": {"person": "thing", "sky": "stuff", ...},
    "ignore": 255
}

출력 JSON 형식 (category, isthing 없을 때):

{
    "names": ["person", "car", "tree", ...],
    "ignore": 255
}

5. 시각화

visualize("dataset")
# 결과: examples/semantic/, examples/instance/, examples/panoptic/

visualize("dataset", splits=["train", "val", "test"], max_samples=10)

지원 형식

  • 입력: YouTube-VOS, VIPSeg, COCO 형식의 JSON
  • 마스크: RLE 인코딩, RGB panoptic 마스크
  • 폴더 구조:
    • split/JPEGImages/video_id/frame.jpg
    • split/video_id/image/frame.jpg
    • split/video_id/mask/frame.png

의존성

  • numpy >= 1.20.0
  • Pillow >= 8.0.0
  • opencv-python >= 4.5.0
  • sanghyunjo

라이선스

MIT License

Metadata

Release files for clean-dataset 0.3.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for clean-dataset 0.3.1
File Size Uploaded
clean_dataset-0.3.1.tar.gz 29.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for clean-dataset 0.3.1
File Interpreter ABI Platform
clean_dataset-0.3.1-py3-none-any.whl Python 3 none any Details

Total release size: 66.5 kB

Release files / clean_dataset-0.3.1.tar.gz

Download URL clean_dataset-0.3.1.tar.gz
Size 29.1 kB
Tags Source
SHA-256 checksum
How to use checksums
27634d177595b64a7815e4a4d24a96b52db458398facdc32968c6686bf86355c
BLAKE2b-256 checksum
How to use checksums
8f089105dbbc71c91d369b39605239e696b0c458514f9b20fdb73e1f908535b5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.0

Release files / clean_dataset-0.3.1-py3-none-any.whl

Download URL clean_dataset-0.3.1-py3-none-any.whl
Size 37.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6f74fb27256c6f114236c6d14aea896d159f68cff2ef123f6c88518158ac299c
BLAKE2b-256 checksum
How to use checksums
2df4a42899fbe70f39d39aca232866acdf067cc45eaa21ea180649ca46eef7c4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.0

Release history Release notifications | RSS feed

This release

0.3.1 This release

2 release files

0.3.0

2 release files

0.2.0

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page