→ Google Drive에 데이터 올리고 colab에서 불러옴.
→ 대용량 파일도 가능, 만약 세션이 끊겨도 드라이브에 남아 있음.
# 1. Google Drive 마운트
from google.colab import drive
drive.mount('/content/drive')
# 2. 압축 해제할 파일 경로 (Google Drive 안의 경로로 수정)
zip_path = "/content/drive/MyDrive/DCC/xz_dataset.zip"
# 3. 압축을 풀 위치 (Colab 내 /content/ 경로)
extract_path = "/content/dataset"
# 4. unzip 실행
!unzip -q "$zip_path" -d "$extract_path"
print("압축 해제 완료! →", extract_path)
import os, sys, glob, textwrap
from pathlib import Path
BASE = Path("/content/dataset/xz_dataset") # 여러분 데이터 최상위
print(BASE.resolve())
assert BASE.exists(), "데이터 최상위 경로가 존재하지 않음"
for split in ["train","val","test"]:
img_dir = BASE/"images"/split
lbl_dir = BASE/"labels"/split
imgs = sorted([p.stem for p in img_dir.glob("*.jpg")] + [p.stem for p in img_dir.glob("*.png")])
lbls = sorted([p.stem for p in lbl_dir.glob("*.txt")])
print(f"[{split}] images={len(imgs)}, labels={len(lbls)}, unmatched(img-no-label)={len(set(imgs)-set(lbls))}, unmatched(label-no-img)={len(set(lbls)-set(imgs))}")