Skip to main content

YOLO Dataset Tools - Comprehensive toolkit for YOLO format dataset processing

Project description

๐ŸŽฏ YDT - YOLO Dataset Tools

A Professional Toolkit for YOLO Dataset Processing

Python Version License Code style: black Type Checked

English | ็ฎ€ไฝ“ไธญๆ–‡


โœจ Features

๐Ÿ–ผ๏ธ Image Processing

  • ๐Ÿ“ SAHI-powered smart slicing
  • ๐Ÿ”„ Rotation with OBB transformation
  • ๐Ÿ“ Multi-method resize (scale & crop)
  • ๐Ÿ“ Coordinate-based precision cropping
  • ๐ŸŽจ HSV color augmentation
  • ๐ŸŽฌ Video frame extraction
  • ๐Ÿš€ Multi-threaded video processing

๐Ÿ“Š Dataset Operations

  • โœ‚๏ธ Smart train/val split
  • ๐Ÿ”— Multi-dataset merging
  • ๐ŸŽฒ Synthetic data generation
  • ๐Ÿค– YOLO auto-labeling
  • ๐Ÿ“ฆ Batch processing

๐Ÿ‘๏ธ Visualization

  • ๐Ÿ–ผ๏ธ Interactive dataset browser
  • โŒจ๏ธ Keyboard controls (n/p/q)
  • ๐ŸŽฏ Class filtering
  • ๐Ÿ“ธ Letterbox preview
  • ๐ŸŽจ Augmentation effects

๐ŸŽฏ Format Support

  • ๐Ÿ“ OBB (Oriented Bounding Box)
  • ๐Ÿ“ฆ Standard BBox
  • ๐Ÿ”„ Auto format detection
  • โœจ Seamless conversion

๐Ÿš€ Quick Start

# Clone and install
git clone https://github.com/yourusername/ydt.git
cd ydt/package
uv venv && uv pip install -e .

# Try it out!
ydt image slice -i ./images -o ./output
ydt image slice -i ./images -o ./output -c 3 -d 2
ydt viz dataset -i ./dataset

๐Ÿ’ป Usage

Command Line

# Image processing
ydt image slice -i ./imgs -o ./out -c 3
ydt image slice -i ./imgs -o ./out -c 3 -d 2 -r 0.1 --overlap-vertical 0.05
ydt image resize -i ./images -o ./resized -s 640 800 1024
ydt image augment -i data.yaml -o ./aug
ydt image video -i ./videos -o ./frames -s 30
ydt image video -i ./videos -o ./frames --parallel -w 4
ydt image crop-coords -i ./images -o ./cropped -c "100,50,600,400"

# Dataset operations
ydt dataset split -i data.yaml -o ./split -r 0.8
ydt dataset merge -i ./ds1 ./ds2 -o ./merged
ydt dataset synthesize -t ./targets -b ./backgrounds -o ./synthetic --objects-per-image 2-5 --split train --train-ratio 0.8
ydt dataset auto-label -i ./images -m ./yolo11n.pt --format bbox -o ./labeled

# Visualization
ydt viz dataset -i ./dataset
ydt viz letterbox -i ./image.jpg
ydt viz augment -i ./image.jpg

Python API

from ydt.image import (
    slice_dataset,
    augment_dataset,
    extract_frames,
    process_images_multi_method,
    concat_images_horizontally,
    concat_images_vertically
)
from ydt.dataset import split_dataset, DatasetSynthesizer, auto_label_dataset
from ydt.visual import visualize_dataset, visualize_letterbox

# Slice large images
slice_dataset("./dataset", "./sliced", horizontal_count=3)

# Grid slicing (2ร—3 = 6 slices)
slice_dataset("./dataset", "./sliced", horizontal_count=2, vertical_count=3)

# Resize images with both scale and crop methods
process_images_multi_method("./images", "./resized", target_sizes=[640, 800, 1024])

# Concatenate images
concat_images_horizontally("img1.jpg", "img2.jpg", "output.jpg", alignment="center")

# Extract frames from videos
extract_frames("./videos", "./frames", step=30)

# Split dataset
split_dataset("./data.yaml", "./split", train_ratio=0.8)

# Auto-label images
result = auto_label_dataset(
    input_dir="./images",
    model_path="./yolo11n.pt",
    format_type="bbox",
    output_dir="./labeled"
)

# Generate synthetic dataset with custom parameters
synthesizer = DatasetSynthesizer(
    target_dir="./targets",
    background_dir="./backgrounds",
    output_dir="./synthetic",
    objects_per_image=(2, 5),  # 2-5 objects per image
    split_mode="trainval",      # Generate train+val
    train_ratio=0.8            # 80% train, 20% val
)
stats = synthesizer.synthesize_dataset(num_images=1000)

# Visualize dataset
visualize_dataset("./dataset", scan_train=True)
visualize_letterbox("./image.jpg", output_dir="./output")

๐Ÿ“ฆ What's Inside

ydt/
โ”œโ”€โ”€ ๐Ÿ–ผ๏ธ  image/       # Image processing
โ”œโ”€โ”€ ๐Ÿ“Š  dataset/     # Dataset operations
โ”œโ”€โ”€ ๐Ÿ‘๏ธ  visual/      # Visualization
โ”œโ”€โ”€ ๐Ÿ› ๏ธ  core/        # Core utilities
โ”œโ”€โ”€ ๐Ÿค–  auto_label/  # Auto-labeling
โ””โ”€โ”€ โšก  cli/         # CLI interface

๐ŸŽฏ Key Features

Dual Format Support

Automatically detects and handles both formats:

Format Values Description
OBB 9 values class_id x1 y1 x2 y2 x3 y3 x4 y4
BBox 5 values class_id x_center y_center width height

Smart Slicing

Powered by SAHI, intelligently slice large images while preserving label accuracy. Supports both horizontal and grid slicing with configurable overlap ratios.

# Horizontal slicing (default)
ydt image slice -i ./images -o ./sliced -c 3 -r 0.1

# Grid slicing (3ร—2 = 6 slices)
ydt image slice -i ./images -o ./sliced -c 3 -d 2 -r 0.1 --overlap-vertical 0.05

# Fine grid slicing with custom overlap
ydt image slice -i ./images -o ./sliced -c 4 -d 3 -r 0.05 --overlap-vertical 0.02

Video Frame Extraction

Extract frames from video files for dataset creation. Supports both sequential and parallel processing.

# Sequential processing (default)
ydt image video -i ./videos -o ./frames -s 30

# Parallel processing for multiple videos
ydt image video -i ./videos -o ./frames --parallel -w 4

Features:

  • ๐ŸŽฏ Smart worker count auto-detection
  • โšก Concurrent video decoding
  • ๐Ÿ“Š Progress tracking per video
  • ๐Ÿ”„ Automatic fallback for single videos

Auto-Labeling

Automatically label images using YOLO models with support for both BBox and OBB formats:

ydt dataset auto-label -i ./images -m ./yolo11n.pt --format bbox -o ./labeled

Features:

  • ๐ŸŽฏ Support for both BBox and OBB formats
  • ๐Ÿค– Automatic format detection and conversion
  • ๐Ÿ“ Clean output directory structure
  • โš™๏ธ Configurable confidence and IOU thresholds
  • ๐Ÿ” Preview mode with --dry-run

Interactive Visualization

Browse your dataset with keyboard controls:

  • n - Next image
  • p - Previous image
  • q - Quit
ydt viz dataset -i ./dataset

๐Ÿ“ License

This project is licensed under the MIT License - see the LICENSE file for details.

๐Ÿ™ Acknowledgments


Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

yolodt-0.2.0.tar.gz (63.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

yolodt-0.2.0-py3-none-any.whl (63.4 kB view details)

Uploaded Python 3

File details

Details for the file yolodt-0.2.0.tar.gz.

File metadata

  • Download URL: yolodt-0.2.0.tar.gz
  • Upload date:
  • Size: 63.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.21

File hashes

Hashes for yolodt-0.2.0.tar.gz
Algorithm Hash digest
SHA256 f4ff45b1967fc79145f30529fcffec8b68e4ba3b32cd1d432e245c27f26c712b
MD5 5e65c6675cae7a5b1614f99466484420
BLAKE2b-256 7365d9a14628ef87281146ca44280102d863f981b4ff62b46be302147bfc44ee

See more details on using hashes here.

File details

Details for the file yolodt-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: yolodt-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 63.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.21

File hashes

Hashes for yolodt-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a72cfd6e6607be2e024202efbf82960c0347cf781697ff250da80f33fdac441b
MD5 2245c4b73b0219b8ed86fde61c8facef
BLAKE2b-256 47f1bd0fcf2d71bafc1d63761586cd859d843cf392d9951ce1333dd27310fa51

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page